View previous topic :: View next topic
|
Author |
Message |
arnab809
New User
Joined: 17 Mar 2023 Posts: 2 Location: India
|
|
|
|
import java.sql.*;
public class TestJDBCConn {
public static void main(String args[])
throws ClassNotFoundException {
String user,password,url;
Connection con = null;
try { String driverClassName = "com.ibm.db2.jcc.DB2Driver"; System.out.println (); System.out.println ( "Loading DB2 JDBC Driver: " + driverClassName ); Class.forName ( driverClassName );
System.out.println ( " successful driver load, version " + com.ibm.db2.jcc.DB2Version.getVersion() );
// Establish Connection; if type-2 z/OS this will trigger load of DLL
url = "jdbc:db2os390:";
user = null;
password = null;
con = DriverManager.getConnection(url,user,password);
System.out.println("Connection created"); con.close();
System.out.println("Connection closed");
}
catch (Exception e)
{
System.out.println(e.toString());
}
}
}
While running this code
getting this error :
Failure in loading native library db2jcct2zos4_64, java.lang.UnsatisfiedLinkError: db2jcct2zos4_64
(Not found in java.library.path): ERRORCODE=-4472, SQLSTATE=null
value of system environment variable $LIBPATH is /usr/lpp/db2c10/jdbc/lib:/lib:/usr/lib:/usr/lpp/IBM/zoautil/lib:/rsusr/ported/li
b:/rsusr/ported/lib/perl5/5.24.0/os390/CORE:.
We are using IBM ZD&T machine and all the software got installed during installation. We have not installed any software or configured anything of our own.
on executing System.out.println(System.getProperty("java.library.path")); we are getting following list of paths:
/Z24D/usr/lpp/java/J8.0_64/lib/s390x/compressedrefs:/Z24D/usr/lpp/java/J8.0_64/l
ib/s390x:/Z24D/usr/lpp/java/J8.0_64/lib/s390x/compressedrefs:/Z24D/usr/lpp/java/
J8.0_64/lib/s390x/j9vm:/Z24D/usr/lpp/java/J8.0_64/lib/s390x:/Z24D/usr/lpp/java/J
8.0_64/../lib/s390x:/Z24D/usr/lpp/java/J8.0_64/lib/icc:/Z24D/usr/lpp/java/J8.0_6
4/lib/s390x:/usr/lpp/db2c10/jdbc/lib:/lib:/usr/lib:/usr/lpp/IBM/zoautil/lib:/rsu
sr/ported/lib:/rsusr/ported/lib/perl5/5.24.0/os390/CORE:.
|
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1744 Location: Tirupur, India
|
|
|
|
Just spitballing here, it looks like this library is not found db2jcct2zos4_64 in the path libraries.
I would do a OMVS find command to see where that library is, and then add that library to the path.
TSO OMVS
Code: |
$ find / -name db2jcct2zos4_64 -depth |
|
|
Back to top |
|
|
arnab809
New User
Joined: 17 Mar 2023 Posts: 2 Location: India
|
|
|
|
No result from this command. Seems its not present. Is ther any other way to connect the db2 through Java code |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
Back to top |
|
|
|