Your class loader looks ok, but you can simplify it to:

        Class.forName("org.gjt.mm.mysql.Driver");

But the way you're getting the connection is strange (to my eyes), here's
an easier way (change the url for you instance):

        DriverManager.getConnectio(
"jdbc:msql://www.myserver.com:1114/contact_mgr",
                "username", "password" );

--mikej
-=-----
mike jackson
[EMAIL PROTECTED]

> -----Original Message-----
> From: Jan Willem Penterman [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 12, 2002 8:15 AM
> To: [EMAIL PROTECTED]
> Subject: JDBC MySQL again
>
>
> Hi,
>
> I searched the archives for a solution to my problem, but couldn't find
> any. Like many, I keep getting the following error:
>
> SQLException: Cannot connect to MySQL server on localhost:3306. Is there
> a MySQL server running on the machine/port you are trying to connect to?
> (java.net.ConnectException)
>
> There's no stacktrace like some other people posted, I don't know why
> not.
> I think I got my sourcecode ok. I tried three different approaches:
>
> Class.forName("org.gjt.mm.mysql.Driver");
> Class.forName("org.gjt.mm.mysql.Driver").newInstance();
> Thread.currentThread().getContextClassLoader().loadClass("org.gjt.mm.mys
> ql.Driver");
>
> I also got this other stuff in my error log when I start Tomcat, but I
> don't know if that's part of my problem or just the result of me ruining
> other files:
>
> Starting service Tomcat-Standalone
> Apache Tomcat/4.0.4
> PARSE error at line 1 column 10
> org.xml.sax.SAXParseException: Element type "web-app" must be declared.
> Server 1.6 is running Press [Ctrl]+[C] to abort Starting service
> Tomcat-Apache Apache Tomcat/4.0.4
> SQLException: Cannot connect to MySQL server on localhost:3306. Is there
> a MySQL server running on the machine/port you are trying to connect to?
> (java.net.ConnectException)
>
> I got:
> Debian3.0/woody
> Tomcat4.0.4
> j2sdk1.3 (BlackDown FCS)
> Mm.mysql-2.0.14
> MySQL 3.23.49
>
> JW
> Shapers
>
> p.s. I have the exact same servlet running fine on
> WindowsXP/Tomcat4.0.3/j2sdk14/mm.mysql-2.0.12/MySQL3.23.49. But I need
> Debian now.
>
> p.s.2 I have a deju-vu at this moment. Weird :)
>
>
>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to