> I am trying to use java servlets with the mm.mysql
> driver and I keep getting the exception: "No suitable
> driver found." I have been able to use the mm.mysql
> driver using applets without a problem.
>
> I downloaded the jswdk from Sun to test my servlets
> out. I have been able to use their sample servlets,
> but when I created my own servlet and tried to connect
> to the Mysql database, I got the "No suitable driver
> found" exception. I have the mysql_comp.jar and
> mysql_uncomp.jar files in the CLASSPATH env variable.
> Anybody know what I am missing?
>
In cases like this, the issue is that the JDBC driver has not been
successfully registered. That is the only cause I have ever seen for
this type of error message.
One possible issue is that some VMs do not necessarily register the
driver when you run code such as:
> Class.forName("org.gjt.mm.mysql.Driver");
Although the previous code is supposed to take care of registration for
you, you should try something like:
> java.sql.DriverManager.registerDriver(new org.gjt.mm.mysql.Driver());
This works around deficiencies in some VMs and is a bit more explicit.
--
Cris Perdue
Impact Online, Inc.
http://www.volunteermatch.org