Meaningless Drivel is fun!
The moose likes JDBC and Relational Databases and the fly likes ARRRGHH DB2-WebSphere AppServer JDBC connection Error on AIX Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "ARRRGHH DB2-WebSphere AppServer JDBC connection Error on AIX" Watch "ARRRGHH DB2-WebSphere AppServer JDBC connection Error on AIX" New topic

ARRRGHH DB2-WebSphere AppServer JDBC connection Error on AIX

joe boone

Joined: Jul 09, 2001
Posts: 2
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 "" driver. we also
selected 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 [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 [nssdb]exception: Error loading JDBC driver:
We have tried setting up vaious env variables such as
NONE of the above has helped.
The support doc ""
Copying to the "/usr/WebSphere/AppServer/bin" directory helps: The "UnsatisfiedLinkError" goes away but then we
get another error: Get connection statement from [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

Hashtable parms = new Hashtable();
parms.put(Context.INITIAL_CONTEXT_FACTORY, "");
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;
==ERROR=====> conn = ds.getConnection( "testuser" , "password"); <=========E R R O R ======================
catch (Exception e)
sendErrorPage(res, "Get connection statement " + "exception: " + e.getMessage());
Julio Lopez

Joined: Nov 14, 2000
Posts: 28
A few things, in the "/home/db2inst1/sqllib/java12" directory is there a file called "inuse"? Also, make sure that the file is in the directory, when you run "usejdbc2" some files including get decompressed from a file and then are transferred to the (most probably, I am a Windows user) "/home/db2inst1/sqllib/java" directory. So while I am confident you know what you are doing, make sure that is still in that directory. If it is not, Uninstall the DB/2 driver instance in the administrative console and Install it pointing to the file in the "/home/db2inst1/sqllib/java" directory. Check this stuff out and let me know.
Julio Lopez
M-Group Systems
I agree. Here's the link:
subject: ARRRGHH DB2-WebSphere AppServer JDBC connection Error on AIX
It's not a secret anymore!