Showing posts with label jdbc. Show all posts
Showing posts with label jdbc. Show all posts

Sunday, June 08, 2008

Glassfish configuration for DB2


I ran into this problem at least twice, so here is the solution (at least for my own reference in the future):

If you want to use a DB2 (UDB) database from glassfish v2 using a Type 2 JDBC driver [1], you must make sure that the (native) library db2jcct2.dll (or .so) is in the (native) library path. The error message usually says something like "Failure in loading T2 native library db2jcct2".

This DLL resides in your DB2 install directory bin directory, e.g. C:\Programme\IBM\SQLLIB\BIN\db2jcct2.dll on windows, so you have to add this directory (C:\Programme\IBM\SQLLIB\BIN) to the glassfish (!!) native library path in the JVM settings

In the domain.xml config file this is the
native-library-path-prefix="c:\programme\IBM\SQLLIB\BIN" option of the java-config setting.

In the admin web GUI it is on the Application Server page;



under the JVM Settings -> Path Settings you will find the option Native Library Path Prefix:


One additional note:
[1] The IBM Type 2 JDBC driver is the one that uses the native DB2 client (used to be called Client Application Enabler or short CAE at my times with DB2 UDB v5) for DB2 access and connectivity. Hence, the necessity to be able to locate the native DLLs... So when the appserver and the DB2 engine run on the same host, you should use type 2 as well.

Saturday, January 20, 2007

JDBC on DB2 UDB 8 stopped working

All of a sudden my netbeans would no longer connect to my DB2 UDB 8.1 database.
Got me a missing package error. So I tried all the usual db2rbind all and bind db2ubind.lst and db2cli.lst and whatnot (whatever I could remember from my DB2 days at IBM).

Still no help.

So I googled for the error message, and indeed IBM changed the package with a fixpak, the details can be found here at the IBM site.

Problem

After upgrading your server to DB2 UDB Version 8.1 FixPak 10 (also known as Version 8.2 FixPak 3), you will encounter an SQL0443N error if invoking a DB2 Call Level Interface (CLI) catalog function (such as SQLTables(), SQLColumns(), or SQLStatistics()). For example: SQL0443N Routine "SYSIBM.SQLTABLES" (specific name "TABLES") has returned an error SQLSTATE with diagnostic text SYSIBM:CLI:-805. SQLSTATE=38553

Cause
The CLI catalog functions execute routines on the DB2 UDB server. These routines use packages that are created by the db2schema.bnd bind file. The package name for db2schema.bnd has a different name in DB2 UDB Version 8.1 FixPak 10 than it did in previous fixpaks. If this bind file does not get bound to all of your existing databases on your server, you will get the SQL0443N error message.

Solution
As documented in the FixPak Readme file for DB2® Universal Database™ (DB2 UDB) Version 8.1 FixPak 10, you will need to bind the db2schema.bnd file locally against each database, as follows:


At a command prompt:
db2 terminate
db2 connect to
db2 bind /db2schema.bnd blocking all grant public sqlerror continue
db2 terminate

...where represents the name of a database to which the utilities should be bound, and where is the full path name of the directory where the bind files are located (usually sqllib/bnd).

The bind operation needs to be done within a local connection to the database.