wood burning stoves 2.0*
The moose likes JDBC and the fly likes No suitable driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "No suitable driver" Watch "No suitable driver" New topic
Author

No suitable driver

Hugh Savoie
Greenhorn

Joined: Oct 16, 2001
Posts: 14
I hope someone can help me!
I'm running windows 2000 pro.
I'm trying to learn about jsp and servlets and have installed Visual age, IBM db2 and wepshere on my computer. Everything was going good then I installed Microsoft server 7 now I cannot connect to my database with any of my servlets. All I get is the following error.
"SQL Error java.sql.SQLException: No suitable driver"
Even in sql 7 I cannot connect to my database I have removed sql 7 but it is the same.
Regards,
Hugh
also I'm using the wepshpere test environment in Visual 4.0 and have a local host set up.
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Hugh
What driver are you using/trying to use? What does your code look like? If your going through ODBC do you have a dsn set up on your machine?
Is the driver in your path?
Also, please don't cross post your questions to multiple forums, most of the visitors here read in many of the forums and it is frustrating to see the same question repeated over and over - you have a better chance of gettng a correct and timely answer if you post it to the most appropriate forum instead of using the shotgun aproach and hoping you'll hit something.
[ February 05, 2002: Message edited by: Dave Vick ]

Dave
Hugh Savoie
Greenhorn

Joined: Oct 16, 2001
Posts: 14
Bellow is a copy of my connection code, I have checked the class path and it looks OK. I don’t think there is a problem with the code as I have not changed it. The only thing different I have done since it stopped working is.
1.Install Microsoft sql 7, used it for a few days everything was fine then I did something to it and I could no longer connect to my database I created with it. Every time I tried to expand the database tree in sql 7 I got a “could not connect error”. So I removed and reinstalled it, this still did not work so I had to install it to another hard drive on my system to finish my lesson.
2.I removed extra copies of java through the control panel, had like 5 copies between my two hard drives.
That’s it.
Regrds,
Hugh
Ps I will follow your advice on multiple posting.
public java.sql.Connection getConn() {
java.sql.Connection conn=null;
try {
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
if (conn == null || conn.isClosed()) {
conn = java.sql.DriverManager.getConnection("jdbc b2:message");
return conn;
}
} catch (java.sql.SQLException SQLE) {
System.out.println("SQL Error " + SQLE);
} catch (ClassNotFoundException CNFE) {
System.out.println("Class not Found Exception" + CNFE);
}
return conn;
}
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Hugh
It looks like the driver you are using is for the IBM DB2 database. If that is the case then it wont work with SQL Server.
Try using the Microsoft SQL server JDBC driver. Put that on your system, change your driver name in your code (or just add it) and you should be ok. It is a type 4 driver so you dont need to worry about a dsn or anything like that either...
hope that helps
 
jQuery in Action, 2nd edition
 
subject: No suitable driver
 
Similar Threads
No suitable driver
Can't connect to remote sql server
No suitable driver Exception for sql server 2000
How Tomcat Works: connection pooling in tomcat
org.springframework.jdbc.UncategorizedSQLException