• JAVA JDBC API com.ibm.extlib.util.JdbcUtil and com.ibm.xsp.extlib.jdbc.dbhelper.DatabaseHelper

    By Sachin Kulkarni 1 decade ago

    I was able to create the Update site for deploying the jars on server and am now able to use SSJS API for JDBC connection. I am not much familiar with JAVA.

    I want to make use of connection pooling in java. I guess I have to make use of the following class

    com.ibm.extlib.util.JdbcUtil
    com.ibm.xsp.extlib.jdbc.dbhelper.DatabaseHelper

    But when I write

    import com.ibm.extlib.util.JdbcUtil; it throws compile error in designer when I try to save it.

    Could someone provide me sample code to do it please. The current working version for jdbc i use  is as below.

    --------------------------------------

    import lotus.domino.*;

    import java.io.PrintWriter;

    import java.sql.Connection;

    import java.sql.DriverManager;

    import java.sql.ResultSet;

    import java.sql.SQLException;

    import java.sql.Statement;

     

    public class JavaAgent extends AgentBase {

    public void NotesMain() {

    try {

    Session session = getSession();

    AgentContext agentContext = session.getAgentContext();

    PrintWriter pw;

    pw = getAgentOutput();

    Connection con = getConnection ();

    Statement stmt = con.createStatement();

    String query = (

    "Select * From snow.test where sequence='TEST'");

    ResultSet rs = stmt.executeQuery(query);

    pw.println(

    "Content-Type:text/html");

    while ( rs.next() ) {

    pw.println( rs.getString(1) +

    " " + rs.getString(2) + "
    "
    );

    }

    rs.close();

    stmt.close();

    con.close();

    catch(Exception e) {

    e.printStackTrace();

    }

    }

    private static Connection getConnection() throws ClassNotFoundException, SQLException{

    Class.forName (

    "com.ibm.db2.jcc.DB2Driver" );

    Connection connection = DriverManager.getConnection(

    "jdbc:db2://server:port/test","db2admin","db2password");

    return connection;

    }

    }