If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Problem connecting to DB2 from Java

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-20-04, 13:15
dmilks dmilks is offline
Registered User
 
Join Date: Aug 2002
Posts: 8
Problem connecting to DB2 from Java

Hi. I'm running a small Java app on an AIX server connecting to a DB2 database. Here's the code:

String dbURL = "jdbc:db2:icmdb01";
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
System.out.println("Connecting to Database URL = " + dbURL);
db = DriverManager.getConnection(dbURL);

The error I'm getting is:

java.sql.SQLException: No suitable driver
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.sql.SQLException.<init>(Compiled Code)
at java.sql.DriverManager.getConnection(Compiled Code)
at java.sql.DriverManager.getConnection(Compiled Code)
at TestConnect.main(Compiled Code)

I've included the DB2 driver in the classpath. If I remove the DB2 driver from the classpath, I get a "ClassNotFound" error. So this tells me that it's something else. Any ideas?
Reply With Quote
  #2 (permalink)  
Old 12-20-04, 16:14
dmilks dmilks is offline
Registered User
 
Join Date: Aug 2002
Posts: 8
Anyone seen this error before?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On