*
The moose likes JDBC and the fly likes no db2jdbc in java.library.path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "no db2jdbc in java.library.path" Watch "no db2jdbc in java.library.path" New topic
Author

no db2jdbc in java.library.path

RichardA Brown
Greenhorn

Joined: Dec 01, 2005
Posts: 3
Hi,

I'm trying to connect from Unix to Mainframe DB2 Version 7 (type 2 driver) and receive this error:

java.lang.UnsatisfiedLinkError: no db2jdbc in java.library.path
at COM.ibm.db2.jdbc.app.DB2Driver.<init>(DB2Driver.java:240)

when executing:

Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();

Does anyone know how to correct this?


Rick Brown
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30123
    
150

Rick,
Welcome to JavaRanch!

Do you have db2java.zip or the mainframe equivalent in your classpath?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
RichardA Brown
Greenhorn

Joined: Dec 01, 2005
Posts: 3
Thanks for the reply!

I unzipped it and added **.class four places but that didn't seem to help --

<path id="class.path">
<fileset dir="${util.lib}">
<include name="*.jar"/>
<include name="**/**.class"/>
</fileset>
<fileset dir="${lib}">
<include name="*.jar"/>
<include name="**/**.class"/>
</fileset>
</path>

<target name="init">
<tstamp />
<mkdir dir="${build}/javadocs" />
<mkdir dir="${dist}" />
<mkdir dir="${web.build}" />
<mkdir dir="${web.lib}" />
</target>

<!-- BEGIN JUST COST ************* -->
<!-- ************** Compile Service Source ************** -->
<target name="compileCost" depends="init">
<javac srcdir="${src}" destdir="${web.build}">
<classpath refid="class.path"/>
<include name="**/**.java" />
<include name="**/**.class"/>
</javac>
<javac srcdir="tester" destdir="${web.build}">
<classpath refid="class.path"/>
<include name="**/**.java" />
<include name="**/**.class"/>
</javac>
</target>
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

java.lang.UnsatisfiedLinkError: no db2jdbc in java.library.path
at COM.ibm.db2.jdbc.app.DB2Driver.<init>(DB2Driver.java:240)


The JDBC driver is looking for a native library (db2jdbc.dll if you're running it on Windows). You should make sure that the DLL is on the PATH (not the classpath).


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
RichardA Brown
Greenhorn

Joined: Dec 01, 2005
Posts: 3
Solution for

java.lang.UnsatisfiedLinkError: no db2jdbc in java.library.path

on the Unix is as follows:

java.lang.UnsatisfiedLinkError: no db2jdbc in java.library.path is a Load Library Path problem. On the Unix the library files are �lib*.so� or �lib*.so.[0-9]�. (On windows it is a DLL file). So I solved the problem by adding to the Jboss startup script:
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/users/db2min1/sqllib/lib
and cycling the Jboss. Note the Load Library Path is different from the Path on the Unix, though in Windows the DLL needs to be on the Path.
/users/db2min1/sqllib/lib is the library with the .so files.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: no db2jdbc in java.library.path
 
Similar Threads
no db2jdbc in java.library.path
Problem connecting to DB2 using Squirrel Database Client
no db2jdbc in java.library.path on suse10.2
db2jdbc Error
VAJ er: UnsatisfiedLinkError: no db2jdbc in java.library.path