This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

No suitable driver

 
Hugh Savoie
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Hugh Savoie
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic