Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / September 2003

Tip: Looking for answers? Try searching our database.

DB2: no suitable driver

Thread view: 
Timo Nentwig - 20 Sep 2003 12:51 GMT
Hi!

I load the app.DB2Driver as I'm used to load any other DB and do a
DriverManager.getConnection():

       java.sql.SQLException: No suitable driver

I thought I might have to set

       LD_LIBRARY_PATH=/home/db2inst1/sqllib/lib

since this is only be done for db2inst1 (who does not run my java
application) but I obviously was wrong.

db2java.zip is in classpath, of course.

What's the point here?

Timo
Joseph Weinstein - 20 Sep 2003 21:33 GMT
> Hi!
>
[quoted text clipped - 13 lines]
>
> What's the point here?

DriverManager is telling you that no driver loaded accepts your URL.
You can call a DriverManager method to find out whether the DB2
driver is loaded, but I expect it is. I'd check the DB2 driver docs about
the expected URL.
Joe Weinstein at BEA

> Timo
Herman Timmermans - 21 Sep 2003 10:33 GMT
> Hi!
>
[quoted text clipped - 15 lines]
>
> Timo

This is because a badly formed URL.  Check your URL string for any errors.
Check your DB2 doc.
Please do not cross post (see also my answer comp.lang.java.programmer)
Brgds,
Herman
Signature

Suse Linux Professional 8.1 on Athlon 1.1 Ghz 512 Mb
Anti Spam = remove the "dot" and the "at"
Registered Linux User #264690

Timo Nentwig - 21 Sep 2003 11:33 GMT
> This is because a badly formed URL.  Check your URL string for any errors.

The URL is (unfortunately :) correct.

jdbc:db2:<database>
jdbc:db2://<host>:<port>/<database>

> Please do not cross post (see also my answer comp.lang.java.programmer)

Apparently this group is read by only few people...
Joseph Weinstein - 22 Sep 2003 18:09 GMT
> > This is because a badly formed URL.  Check your URL string for any errors.
>
> The URL is (unfortunately :) correct.
>
> jdbc:db2:<database>
> jdbc:db2://<host>:<port>/<database>

Ok then. Do run the drivermanager call to see what drivers are registered. If the driver
you want is not registered, you can call the drivermanager method to do that. Then,
with the driver instance you registered, call acceptsURL() with the URL you are
going to send to the connection attempt.

Or just cut the drivermanager out ot the picture. Do this:

Driver d = new <your driver class name here>;

Properties p = new Properties();
p.put("user", <your user> );
etc... put all your properties needed.

Connection c = d.connect(<YOUR URL>, p );

if (c == null) then the driver you have doesn't accept that URL.

Joe

> > Please do not cross post (see also my answer comp.lang.java.programmer)
>
> Apparently this group is read by only few people...
Timo Nentwig - 23 Sep 2003 07:54 GMT
> Or just cut the drivermanager out ot the picture. Do this:
>
> Driver d = new <your driver class name here>;

Class driverClass = Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
Driver _driver = (Driver) driverClass.newInstance();

newInstance throws:

java.sql.SQLException: [IBM][JDBC Driver] CLI0647E  Error allocating DB2
environment handle, rc=-1.
Joseph Weinstein - 23 Sep 2003 15:57 GMT
> > Or just cut the drivermanager out ot the picture. Do this:
> >
[quoted text clipped - 7 lines]
> java.sql.SQLException: [IBM][JDBC Driver] CLI0647E  Error allocating DB2
> environment handle, rc=-1.

This means that there is some environmental problem eg: your environment variables
for the driver not set, or some other native-code level problem. I would also
send this error message to an IBM newsgroup for deciphering.
Joe
Bob Kranson - 23 Sep 2003 18:02 GMT
This post says you need to set environmet var 'DB2INSTANCE':
http://www.developer.ibm.com/tech/faq/individual/0,,2:24408,00.html

> > > Or just cut the drivermanager out ot the picture. Do this:
> > >
[quoted text clipped - 12 lines]
> send this error message to an IBM newsgroup for deciphering.
> Joe
Timo Nentwig - 24 Sep 2003 17:13 GMT
> This post says you need to set environmet var 'DB2INSTANCE':
> http://www.developer.ibm.com/tech/faq/individual/0,,2:24408,00.html

Thanks!

Ok, at least I can connect now. But when listing the table with DbVisualizer
(www.minq.se) it get a DB2Exception:

[IBM][JDBC Driver] CLI0601E Invalid statement handle or statement closed.
SQLSTATE=51000.

I yet didn't do any JDBC stuff on my own...
Timo Nentwig - 25 Sep 2003 07:00 GMT
> Ok, at least I can connect now. But when listing the table with
> DbVisualizer (www.minq.se) it get a DB2Exception:
>
> [IBM][JDBC Driver] CLI0601E Invalid statement handle or statement closed.
> SQLSTATE=51000.

And with DbEdit on eclipse I cannot even connect:

[IBM][CLI Driver] CLI0108E  Communication link failure. SQLSTATE=40003
 dbedit.core.DataException: [IBM][CLI Driver] CLI0108E  Communication link
failure. SQLSTATE=40003
 COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0108E  Communication
link failure. SQLSTATE=40003

:-(
Timo Nentwig - 25 Sep 2003 07:01 GMT
> And with DbEdit on eclipse I cannot even connect:
>
[quoted text clipped - 4 lines]
>   COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0108E  Communication
> link failure. SQLSTATE=40003

followed by...

[IBM][JDBC Driver] CLI0601E  Invalid statement handle or statement is
closed. SQLSTATE=S1000
 dbedit.core.DataException: [IBM][JDBC Driver] CLI0601E  Invalid statement
handle or statement is closed. SQLSTATE=S1000
 COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC Driver] CLI0601E  Invalid
statement handle or statement is closed. SQLSTATE=S1000
Bob Kranson - 25 Sep 2003 18:57 GMT
Seems like you need to look closer at your DB2 install and setup.  Your DB2
URL may need extra value pairs to establish the correct TYPE of
connection....refer DB2 docs and IBM/DB2 java docs.

> > This post says you need to set environmet var 'DB2INSTANCE':
> > http://www.developer.ibm.com/tech/faq/individual/0,,2:24408,00.html
[quoted text clipped - 8 lines]
>
> I yet didn't do any JDBC stuff on my own...
Bob Kranson - 22 Sep 2003 17:17 GMT
You need DB2 client access installed on the local machine even though you
have the jdbc driver.

IBM has come out (v8.1) with a "Universal JDBC Driver" which does not
require the Client installation.  This provides two different archives:
java/db2jcc.jar, java/sqlj.zip.  This is dependant on your DB2 version
though....

Regards,
BobK

> Hi!
>
[quoted text clipped - 15 lines]
>
> Timo
Timo Nentwig - 23 Sep 2003 07:49 GMT
> java/db2jcc.jar, java/sqlj.zip.  This is dependant on your DB2 version

So, ok, I tried the driver in db2jcc.jar (com.ibm.db2.jcc.DB2Driver):

com.ibm.db2.jcc.b.SQLException: Unable to load T2 native library.  Type 2
JDBC architecture is not yet supported by the IBM DB2 JDBC Universal Driver
Architecture


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.