jdbc connection error with DB2 8.1 64-bit client

jdbc connection error with DB2 8.1 64-bit client

Post by suji » Sun, 08 Jun 2003 00:45:34



I have a small test java program that makes a JDBC connection to
the DB2 8.1 64-bit database from a client machine that has both
DB2 8.1 32-bit and DB2 8.1 64-bit clients. It works with the
32-bit client & does not work with the 64-bit client.

I get the following error with DB2 8.1 64-bit client.

Quote:> java SimpleConnection COM.ibm.db2.jdbc.app.DB2Driver jdbc:db2:lsp610db

lspus01 lspus01

java.sql.SQLException:
java.lang.UnsatisfiedLinkError:
/usr/opt/db2_08_01/lib64/libdb2jdbc.so:  load
ENOEXEC on shared library(s) /usr/opt/db2_08_01/lib64/libdb2jdbc.so
        at COM.ibm.db2.jdbc.app.DB2Driver.<init>(Unknown Source)
        at java.lang.Class.newInstance0(Native Method)
        at java.lang.Class.newInstance(Class.java:262)
        at SimpleConnection.main(SimpleConnection.java:21)

SimpleConnection.java is a small test program that tries to
make a JDBC connection to the DB2 8.1 64-bit database.

The same program works fine when I use the 8.1 32-bit client.

Here's my environment for the 64-bit DB2 8.1 client:

export DB2_HOME=/dba/u01/app/db2/d8164dv1/sqllib
LIBPATH=$DB2_HOME/lib:$LIBPATH
export LIBPATH=/opt/6.1-stack/jdk1.3.1/jre/bin/classic:$LIBPATH
export PATH=$DB2_HOME/bin:$PATH
export DB2DATABASE=lsp610db
export DB2USERNAME=lspus01
export DB2PWD=lspus01
export CLASSPATH=/dba/u01/app/db2/d8164dv1/sqllib/java/db2java.zip:$CLASSPATH
source $DB2_HOME/db2profile

The library that it is unable to load is present in the
LIBPATH environment variable.

Quote:> ls -l $DB2_HOME/lib/libdb2jdbc.so

-r--r--r--   1 bin      bin          168994 Oct 29 2002
/dba/u01/app/db2/d8164dv1/sqllib/lib/libdb2jdbc.so

The environment for the 32-bit client is the same except that
all occurances of the string "64" in the above environment are
replaced by the string "32".

I also see that the jdbc driver file is the same in the 32-bit and
the 64-bit client. Not sure whether this is expected.

This is the 64-bit jdbc driver

Quote:> ls -l /dba/u01/app/db2/d8164dv1/sqllib/java/db2java.zip

-r--r--r--   1 bin      bin         1533694 Oct 29 2002
/dba/u01/app/db2/d8164dv1/sqllib/java/db2java.zip

This is the 32-bit jdbc driver

Quote:> ls -l /dba/u01/app/db2/d8132dv1/sqllib/java/db2java.zip

-r--r--r--   1 bin      bin         1533694 Oct 29 2002
/dba/u01/app/db2/d8132dv1/sqllib/java/db2java.zip

Here' the SimpleConnection.java: ( Compile it by running javac
SimpleConnection.java )

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Driver;
import java.sql.SQLException;

public class SimpleConnection {

  static void main(String args[]) {

    Connection connection = null;
    // Process the command line
    if ( args.length != 4 ) {
      System.out.println("Usage: java SimpleConnection " +
                         "DRIVER URL UID PASSWD");
      System.out.println("For eg., java SimpleConnection " +
      "COM.ibm.db2.jdbc.app.DB2Driver jdbc:db2:lsp601db lspus01
lspus01");
      return;
    }

    try { // load the driver
        DriverManager.registerDriver((Driver)
Class.forName(args[0]).newInstance());
    }
    catch(Exception e) {
      e.printStackTrace();
      return;
    }

    try {
      connection = DriverManager.getConnection(args[1], args[2],
args[3]);
      System.out.println("Connection successful !");
    }
    catch(Exception e) {
      e.printStackTrace();
    }
    finally {
      try {
        connection.close();
      }
      catch( SQLException e ) {
        e.printStackTrace();
      }
    }
  }  

Quote:}

// end of SimpleConnection.java
 
 
 

1. 64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit, Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new !

64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit,
Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new
!

Windows Liberty 64bit                                          8403

Windows Limited Edition 64 Bit Edition                         8764

Microsoft SQL Server 2000 Developer Edition 64 Bit              12 000

IBM DB2 UNIVERSAL CONNECT ENTERPRISE EDITION V8.1.2 64BIT       12 211

IBM DB2 Administration Client V8.1.2 64bit W3KSERVER            12 266

IBM DB2 UDB Enterprise Server Edition V8.1.2 64Bit W3KSERVER    12 284

IBM DB2 Connect Applic Server Edition V8.1.2 64bit W3KSERVER    12 392

IBM DB2 Spatial Extender v8.1 64Bit Multilanguage               12 610

If you have Googled your butt off, and haven't come up with anything
...,  and for 14,000 more reasons, please send e-mail,

2. Oracle 8.1.6 NT and SSL

3. Beta Program of 64-bi DB2 on 64-bit Windows .Net and Intel-based IPF systems

4. <ad> GUARANTEED CREDIT REPAIR BY LAW FIRM

5. DB2 64 bit - 32 bit problem

6. Help please.. saving/naming files based on a text field.. THANK YOU!

7. DB2/UDB version 6.1 - is it 32-bit or 64-bit on AIX 4.3

8. 64 Bit Informix on a 64 bit V-Class

9. 32-bit Clients to 64-bit Oracle Server

10. 32-bit client to 64-bit server

11. 64 bit client accessing 32 bit server?

12. Interoperability of 32-bit and 64-bit client/server