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.

> 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
PATH=/opt/6.1-stack/jdk1.3.1/bin:$PATH
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.
> 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
> 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
> 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 public 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();
}
}
}
}

// end of SimpleConnection.java