My Agent code:
import lotus.domino.*;
import java.sql.*;
import COM.ibm.db2.jdbc.*;
import java.io.PrintWriter;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
DB2App1 b=new DB2App1();
String p=b.value();
PrintWriter pw = getAgentOutput();
pw.println("result = " + p);
} catch(Exception e) {
e.printStackTrace();
}
}
}
class DB2App1
{
static
{
try
{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
}
catch(Exception e)
{
System.out.println("driver"+e);
}
}
// public static void main(String argv)
// {
public String value()
{
String a=null;
String l="jdbc:db2:CUSTOMER";
try
{
Connection con=DriverManager.getConnection(l,"db2admin","password");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from account where lastname='Aaden' ");
//System.out.println("received results");
while(rs.next())
{
a=rs.getString(1);
//String str=rs.getString(2);
//System.out.println("custNo="+a);
//System.out.println("firstname="+str);
//System.out.print("");
}
rs.close();
stmt.close();
}
catch(Exception e)
{
System.out.println(e);
}
//a="adasfd";
return a;
//}
}
}
why?
Tks for any suggestions!