Hi, This may be a simple thing I am overlooking so thanks in advance for any help. I am trying to connect to a mySQL database through a servlet that is called from a html form submission. I have all the connection properties in a simple class and when I try to instantiate the class, I get this error..... java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver now the first thing I did was assume that I had the classpath set-up wrong. So I re-did it and it still failed. So I create a simple class in the main method all i do create an instance of the same object that is failing my servlet. ANd you know what?? It works fine, the connection is established no problem. So I know that the classpath is set OK, but I can't understand why it would work in one spot and not in the other. Does it have something to do with being called from a servlet?? I am so frustrated here. Any Ideas??? Scott, scjp
The first thing I would mention is that you may be using an old JDBC Driver for MySQL. That is not your problem per say, but you will want to download the latest Driver called Connector/J from here The next thing is org.gjt.mm.mysql.Driver you will want to change to com.mysql.jdbc.Driver. That is the new Driver class used with Connector/J. As for your problem what I would like you to try or make sure of is that you have your JDBC Driver in the appropriate location. You should have a lib folder under your WEB-INF folder of your web app. This is where you will want to put all libraries your web app may be accessing. Including your JDBC Driver. Try that, and then let us know if this was the case or not.