Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2001
    Posts
    1

    Unanswered: DB2-WebSphere AppServer JDBC connection Error on AIX

    Hi,

    We are using WebSphere App Server AE 3.5.3 with DB2 6.1 sp5. Both are installed on an AIX box.
    We have configured the appropriate datasource called "nssdb" in the WebSphere using the "com.ibm.jdbc.app" driver. we also
    selected db2java.zip in "/home/db2inst1/sqllib/java12" .

    When we run the servlet below, although we are able to get the Datasource object properly from the lookup, we are not able to get a connection
    from the data source (using conn = ds.getConnection).

    We get the follwoing errors:

    when URL is jdbc:jta:db2 and JTA is enabled: Get connection statement from com.ibm.ejs.cm.JTADataSource@c758afe8 [nssdb]exception: java.lang.UnsatisfiedLinkError: no library db2jdbc (libdb2jdbc.a or .so) in java.library.path.

    when url is jdbc:db2 and JTA is disabled: Get connection statement from com.ibm.ejs.cm.JDBCDataSource@2f03221f [nssdb]exception: Error loading JDBC driver: com.ibm.db2.jdbc.app.DB2Driver.

    We have tried setting up vaious env variables such as
    export
    CLASSPATH=$CLASSPATH:/home/db2inst1/sqllib/java12/db2java.zip
    LIBPATH=$LIBPATH:/home/db2inst1/sqllib/java12:/home/db2inst1/sqllib/
    LIB=$LIB:/home/db2inst1/sqllib/java12:/home/db2inst1/sqllib
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH/home/db2inst1/sqllib/java12:/home/db2inst1/sqllib
    DB2INSTANCE=db2inst1

    NONE of the above has helped.
    The support doc "http://www-4.ibm.com/cgi-bin/db2www/data/db2/udb/winos2unix/support/document.d2w/report?&fn=1008029"
    ALSO DID NOT HELP.

    Copying lbdb2jdbc.so to the "/usr/WebSphere/AppServer/bin" directory helps: The "UnsatisfiedLinkError" goes away but then we
    get another error: Get connection statement from com.ibm.ejs.cm.JTADataSource@c758afe8 [nssdb]exception: SQLAllocEnv() Error: rc = -1.

    Can anyone help? May be you can forward this to somebody who could?



    ============code below====================================

    public class NSSEventServlet extends HttpServlet
    {

    private static DataSource ds = null;


    public void init(ServletConfig config) throws ServletException
    {

    super.init(config);
    try
    {
    Hashtable parms = new Hashtable();
    parms.put (context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory") ;
    Context ctx = new InitialContext(parms);
    ds = (DataSource)ctx.lookup("jdbc/nssdb");
    }
    catch (Exception e)
    {
    System.out.println("Naming service exception: " + e.getMessage());
    }

    }


    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException
    {
    Connection conn = null;
    try
    {
    ==ERROR=====> conn = ds.getConnection( "testuser" , "password"); }
    catch (Exception e)
    {
    sendErrorPage(res, "Get connection statement " + "exception: " + e.getMessage());
    }
    }

    Ravi Bansal
    rbansal@us.ibm.com

  2. #2
    Join Date
    Oct 2009
    Posts
    24
    you should probably upgrade your WAS and DB2 to more current levels

  3. #3
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    some entries are missing in classpath
    see
    Installing the IBM Data Server Driver for JDBC and SQLJ
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •