Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 1825
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 copying data without knowing location arunsoods DFSORT/ICETOOL 6 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 18 Thu Jul 13, 2017 2:11 pm
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am
No new posts NDM syntax checking without actually ... GAPX1 All Other Mainframe Topics 0 Wed Jun 07, 2017 2:36 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us