DB2: no suitable driver

T

Timo Nentwig

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
 
H

Herman Timmermans

Timo said:
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

Did you check your url for any errors? I've experience this errors when
having badly formed url strings.
Besst regards,
Herman
 
T

Timo Nentwig

Herman said:
Did you check your url for any errors? I've experience this errors when
having badly formed url strings.

The URL is (unfortunately :) correct.

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

Gert van der Kooij

The URL is (unfortunately :) correct.

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

When using the app driver you can only use jdbc:db2:<database>

It's also necessary to set your DB2 environment correctly, check the
quick beginnings quide for your OS.
 
H

Hugo Pragt

When applying a fixpack to your DB2 installation, this error occures. just
get the db2java.zip and db2jcc.jar directly fom the db2 server and you're
ready to go.

notorious error going to FP3)


Hugo Pragt
 
T

Timo Nentwig

Hugo said:
When applying a fixpack to your DB2 installation, this error occures. just

I did not apply any fixpack...
get the db2java.zip and db2jcc.jar directly fom the db2 server and you're
ready to go.

What server? Can you give me an URL?

Timo
 
T

Timo Nentwig

Hugo said:
You have a db2 server (for this example we call it 'B')

on 'B' there exists a directory called java under the db2 installation
directory
in the directory java there are several files. The library files you need
for the drivers are:
db2java.zip (contains the net and the app driver) and
db2jcc.jar (contains the jcc driver)

There are the certified correct drivers for the database on server 'B'
Copy them into your classpath and make sure no other db2java.* or db2jcc.*
files are in your classpath (at least not before these ones).

Well, I simply put $DB2_HOME/java/db2java.zip in classpath...what's the
probelem with that?
 
T

Tor Iver Wilhelmsen

Timo Nentwig said:
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

What connection string do you use?
 
H

Hugo Pragt

You have a db2 server (for this example we call it 'B')

on 'B' there exists a directory called java under the db2 installation
directory
in the directory java there are several files. The library files you need
for the drivers are:
db2java.zip (contains the net and the app driver) and
db2jcc.jar (contains the jcc driver)

There are the certified correct drivers for the database on server 'B'
Copy them into your classpath and make sure no other db2java.* or db2jcc.*
files are in your classpath (at least not before these ones).

Hugo
 
H

Hugo Pragt

No problem whatsover EXCEPT when that classpath is NOT the one being used.
Applications have this tendency to use their own classpath and not the
system one. Or else they concat the system classpath and the END of their
own (thus after a 'bad' db2java lib).

Hugo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top