Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
JDBC Connectivity using Data Studio jar files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Rai Raman

New User


Joined: 28 Feb 2013
Posts: 2
Location: South Africa

PostPosted: Sun Jul 21, 2013 9:22 pm    Post subject: JDBC Connectivity using Data Studio jar files
Reply with quote

Hi all,

Has anybody tried using the jar files that come with IBM Data Studio in a custom java program?

I'm trying to connect to a DB2 db on Z/OS, and while I can do that using Data Studio with no issues, I keep getting a class not found exception when I run the custom java program.

Code:

c:\temp2>dir
 Volume in drive C has no label.
 Volume Serial Number is 3206-6E75

 Directory of c:\temp2

21/07/2013  17:00    <DIR>          .
21/07/2013  17:00    <DIR>          ..
09/04/2012  03:07         3,507,640 db2jcc.jar
09/04/2012  03:07             2,068 db2jcc_license_cisuz.jar
21/07/2013  17:07             2,973 EzJava.class
21/07/2013  17:13             3,195 EzJava.java
               4 File(s)      3,515,876 bytes
               2 Dir(s)  51,066,073,088 bytes free

c:\temp2>java -cp . EzJava
**** Enter class EzJava
Could not load JDBC driver
Exception: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver
java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at EzJava.main(EzJava.java:21)


I've decompiled the jars and the class that the JVM cannot find is definitely there.

Thanks in advance,
Rai
Back to top
View user's profile Send private message

Rai Raman

New User


Joined: 28 Feb 2013
Posts: 2
Location: South Africa

PostPosted: Sun Jul 21, 2013 9:58 pm    Post subject: Reply to: JDBC Connectivity using Data Studio jar files
Reply with quote

Ok, I should really go back to Java 101.

Compile your code with both jar files:

Code:
javac -cp ./db2jcc.jar;./db2jcc_license_cisuz.jar EzJava.java


Then, run with both jar files:

Code:
java -cp .;./db2jcc.jar;./db2jcc_license_cisuz.jar EzJava


And that should work!

Regards,
Rai
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Mon Jul 22, 2013 6:43 pm    Post subject:
Reply with quote

Did someone just ask a question and answer it themselves?
Which is fine, but I was amused with the way it was answered.. like different person answering a question. icon_smile.gif

Anyway, thanks for sharing that the issue is resolved.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1932
Location: UK

PostPosted: Mon Jul 22, 2013 11:15 pm    Post subject:
Reply with quote

I think s/he was providing the solution to the next poor soul who has to do this so they were writing to that person. Makes sense?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jul 23, 2013 12:13 am    Post subject:
Reply with quote

Yup, I suspect that there will be more people doing this sort of thing.

This is probably something that will help multiple people going forwqard.

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us