No suitable driver, JDBC on a servlet

Problems with the Windows version of XAMPP, questions, comments, and anything related.

No suitable driver, JDBC on a servlet

Postby The zxeno prophet » 11. December 2009 23:52

Edit: I solved my problem, the url was badly wirtten, apparently if the url is badly writted sometime the DriverManager give you a "'No suitable driver"

So I guess it's pretty clear from the title, I'm trying to make a servlet that will connect to a local database, everything is under XAMPP (Tomcat, Apache and MySql I mean). But when I try to connect with :
Code: Select all
m_Connection = DriverManager.getConnection("jdbc:mysql:" + url + "test?user="+ login +"&password=" + password);


I get a SQLException : No suitable driver

So of course I loaded the driver before, I tried :
-com.mysql.jdbc.Driver
-org.gjt.mm.mysql.Driver

I tried with the newInstance() method and with both driver at the same time (I know it sound stupid but who knows =P)
Does anybody know what is appening ?

Edit: forgot to mention the XAMPP version it's 1.7.2 (the last stable version if I'm correct)
Last edited by The zxeno prophet on 12. December 2009 14:26, edited 1 time in total.
The zxeno prophet
 
Posts: 4
Joined: 11. December 2009 23:43

Re: No suitable driver, JDBC on a servlet

Postby Izzy » 12. December 2009 00:00

Did you install the Tomcat addon?

IF so, is Tomcat showing running in your XAMPP Control Panel?
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: No suitable driver, JDBC on a servlet

Postby Wiedmann » 12. December 2009 00:19

So of course I loaded the driver before, I tried :

You have installed one of those drivers?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: No suitable driver, JDBC on a servlet

Postby The zxeno prophet » 12. December 2009 13:45

Izzy wrote:Did you install the Tomcat addon?

IF so, is Tomcat showing running in your XAMPP Control Panel?

Yeah of course, the servlet is running fine
edit: except for that exception of course

Wiedmann wrote:
So of course I loaded the driver before, I tried :

You have installed one of those drivers?

By installed you mean coping the library into WEB-INF/lib folder of the servlet right ? Also I'm devloping the servlet with eclipse do I have to do something more to install the drivers ?

btw the driver lib I'm using is the J-Connector 5.1.10 download from mysql website
The zxeno prophet
 
Posts: 4
Joined: 11. December 2009 23:43

Re: No suitable driver, JDBC on a servlet

Postby Wiedmann » 12. December 2009 14:05

By installed you mean coping the library into WEB-INF/lib folder of the servlet right ?

If I read this correctly:
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#MySQL%20DBCP%20Example
You must copy the jar to "\xampp\tomcat\lib".
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: No suitable driver, JDBC on a servlet

Postby The zxeno prophet » 12. December 2009 14:23

Wiedmann wrote:
By installed you mean coping the library into WEB-INF/lib folder of the servlet right ?

If I read this correctly:
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#MySQL%20DBCP%20Example
You must copy the jar to "\xampp\tomcat\lib".

Apparently it works with both folder, I guess it depends if you want your servlet to use a special version of the J-Connector or not

Also I solved my problem, the url was badly writted and apparently it give the "No suitable driver"
The zxeno prophet
 
Posts: 4
Joined: 11. December 2009 23:43


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 71 guests