Unix Technical Forum

Newbie - problem accessing DB2 with Java program.

This is a discussion on Newbie - problem accessing DB2 with Java program. within the DB2 forums, part of the Database Server Software category; --> zalek wrote: > In my installation we have DB2 on a mainframe computer. I am able to > access ...


Go Back   Unix Technical Forum > Database Server Software > DB2

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 03-20-2008, 12:46 PM
RedGrittyBrick
 
Posts: n/a
Default Re: Newbie - problem accessing DB2 with Java program.

zalek wrote:
> In my installation we have DB2 on a mainframe computer. I am able to
> access DB2 from my PC (WinXP) using some utilities. I wrote a Java
> program to access DB2, but I am getting errors.
> After command:
> Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
>
> I am getting exception:
> Exception java.lang.ClassNotFoundException:
> COM.ibm.db2.jdbc.app.DB2Driver



Case matters, I've not used DB2 but are you certain the COM is capitalised?

I'd expect
com.ibm.db2.jdbc.app.DB2Driver
instead of
COM.ibm.db2.jdbc.app.DB2Driver


Also, you are cross-posting to four newsgroups, a lot of people will
have their newsreaders configured to treat highly cross-posted messages
as SPAM and ignore them. IME it is better to pick one newsgroup.

Followups set to c.l.j.d only.


--
RGB
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 03-20-2008, 12:46 PM
zalek
 
Posts: n/a
Default Re: Newbie - problem accessing DB2 with Java program.

On Mar 16, 10:17 pm, Arne Vajhøj <a...@vajhoej.dk> wrote:
> Alex.From.Ohio.J...@gmail.com wrote:
> > Another very nice way to use classes (actually jar files) without
> > touching classpath is to put these jar files to the $JAVA_HOME/jre/lib/
> > ext/ directory.
> > For example, in my case, when I put db2java.zip and
> > db2jcc.jar to the
> > "C:\Program Files\Java\jre1.6.0_03\lib\ext\"
> > it is available for any Java application.

>
> > Just make sure that you put these jar files to the Java what you use!
> > Or put it to the all Java installations on your computer if you are
> > not sure which one you use

>
> Very bad way.
>
> Builds will break when Java is updated.
>
> It does not work with multiple versions of the same software.
>
> Etc..
>
> Arne


Guys,

Thanks to all for your help - Arne was 100% right - it is my fault.
After receiving class not found conditions I copied db2java.zip and
db2jcc.jar to any possible directory - it does not help. I removed
these files, put to only 1 directory and using "properties" in
JBuilder I added pointed to this directory - and now my Java program
is working.
Thanks again!

Zalek
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:19 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com