Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum 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: 691
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: 2253
Location: Hampshire, 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: 19254
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 Reading the CSV data in COBOL and mov... wik123 COBOL Programming 4 Tue Dec 03, 2019 5:13 pm
No new posts Substring for 2 files in Sort JCL Shubhendu Chakraborty DFSORT/ICETOOL 1 Wed Nov 20, 2019 11:07 am
No new posts Substring for 2 files in Sort JCL Shubhendu Chakraborty SYNCSORT 5 Wed Nov 20, 2019 11:04 am
No new posts Extract data from n DB2 Views automat... esmeraldo All Other Mainframe Topics 5 Wed Nov 13, 2019 12:32 am
No new posts adrdssu for copy all data robyjhl JCL & VSAM 5 Tue Nov 12, 2019 11:17 pm

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