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 > No Sutable Driver Found Error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-01-03, 16:33
Ane4ka Ane4ka is offline
Registered User
 
Join Date: Dec 2002
Posts: 12
No Sutable Driver Found Error

On WebLogic Linux server I'm running a servlet and trying to connect to db2. I get the following error: 'No suitable driver '

Here is the code that I use to connect:

try {
String driver = "COM.ibm.db2.jdbc.app.DB2Driver";
Class.forName(driver);

}catch(Exception e){
throw(new UnavailableException(this, "Sorry! The Database didn't load!"));}

try {
String url = "jdbc:db2:" + LOGID_DATA_SOURCE;
con = DriverManager.getConnection (url,LOGID_USER,LOGID_PASSWORD);
stStatement = con.createStatement();
}catch (SQLException e) {
out.println("SQL Exception: " + e.getMessage() + "\n");
}


I also set up following environment variables:
export CP_CLASSPATH=/home/db2clnt7/sqllib/java/sqlj.zip:/home/db2clnt7/sqllib/java/db2java.zip:/home/db2clnt7/sqllib/java/runtime.zip
export CP_LD_LIBRARY_PATH=/home/db2clnt7/sqllib/lib
export CP_PATH=/home/db2clnt7/sqllib/bin:/home/db2clnt7/sqllib/adm:/home/db2clnt7/sqllib/misc

Can you please advise what am I doing wrong? And why am I getting 'No suitable driver found error"

Thanks in advance
Reply With Quote
  #2 (permalink)  
Old 12-01-03, 16:57
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Re: No Sutable Driver Found Error

Quote:
Originally posted by Ane4ka
On WebLogic Linux server I'm running a servlet and trying to connect to db2. I get the following error: 'No suitable driver '

Try using NET driver (COM.ibm.db2.jdbc.net.DB2Driver) instead of the APP driver.
Reply With Quote
  #3 (permalink)  
Old 12-01-03, 17:34
Ane4ka Ane4ka is offline
Registered User
 
Join Date: Dec 2002
Posts: 12
Re: No Sutable Driver Found Error

Quote:
Originally posted by n_i
Try using NET driver (COM.ibm.db2.jdbc.net.DB2Driver) instead of the APP driver.
That didn't help.

Thanks!
Reply With Quote
  #4 (permalink)  
Old 12-01-03, 18:39
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Re: No Sutable Driver Found Error

Quote:
Originally posted by Ane4ka
That didn't help.

Thanks!
Well, the error you get can only mean two things: either the driver didn't load properly or it can't handle the url you're trying to pass to it. Check the url syntax and ensure that the driver loads (no security violation etc.). See if WebLogic log files contain any useful information.

As a side note, I think you would want to use WebLogic's JDBC connection pool instead of establishing your own connections from a servlet...
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