Hi all,

The past hours I tried to set up Tomcat on my local Win2000 box. I've
installed the lastest MySQL package and also the latest Tomcat version I
got.

After I've read the manual of the JDBC Driver I was able to set it up
that I can connect to MySQL with my short Java Class I wrote. This class
simply creates some tables in MySQL, so far so good.
Afterwards I tried to use exactly the same way of connecting to MySQL in
my JSP Files, again using Java to connect to MySQL. But it doesn't
matter how I try to do it, I always get the
"javax.servlet.ServletException: No suitable driver..." Exception.

I connect like this:

   try
        {
        Class.forName("org.gjt.mm.mysql.Driver").newInstance();
        }

        catch(Exception e)
        {
            System.err.println("Unable to load driver.");
            e.printStackTrace();
        }

        con =
DriverManager.getConnection("jdbc:mysql://localhost/horse");

As I said this *works* if I do that with a simple Java test-Class, but
not after I try to do it in Tomcat. Classpath should be correct, at
least I double checked it about 100 times. The Java files I use are in a
package, could that be a problem? The test files are not in the package
(to be honest, I don't really understand this package stuff :-)

I've also tried to add the port (3306 which seems to be default port in
MySQL) after localhost but this doesn't help. Is there a way to check if
the port is really used in Windows?

I'm really running out of ideas now, I checked all the information I
found, checked the web on other mailinglists (google rulez) and every
thing I tried did not help so far. So any suggestions are very welcome
:-)

thanks in advance

Angela

Reply via email to