wood burning stoves 2.0*
The moose likes JDBC and the fly likes java.sql.SQLException: No suitable driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.sql.SQLException: No suitable driver" Watch "java.sql.SQLException: No suitable driver" New topic
Author

java.sql.SQLException: No suitable driver

Suresh Khant
Ranch Hand

Joined: Feb 27, 2010
Posts: 118
Hi All ,

I am new to jsp , trying to work with data source (mysql ) using tomcat 6 , I have read the tutorial from the link


but am getting the following error :





I have placed mysql connector jar in tomcat lib as well as in my example project web-info/lib , but still getting the same error

context.xml





web.xml




test.jsp





by the way i have another jsp page in the same example project which access the database but without data source and it worked fine

Any suggestion .
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3710
    
    5

Never connect to a database inside a JSP!!!

That said, have you tried checking the JDBC FAQ? It doesn't look like your register the driver, ie Class.forName().


My Blog: Down Home Country Coding with Scott Selikoff
Suresh Khant
Ranch Hand

Joined: Feb 27, 2010
Posts: 118
Thanks Scott Selikoff for your reply ,

As per your reply I have make the data connection in a separate bean & i have registered the driver as the following





, but am getting the same error ..



any suggestion
Ram Narayan.M
Ranch Hand

Joined: Jul 11, 2010
Posts: 247

Have mysql-connector jar file in tomcat lib since all other web applications will use it...

And make sure that the CLASSPATH has been set for mysql-connector jar in tomcat lib...


SCJP 6 [SCJP - Old is Gold]
Suresh Khant
Ranch Hand

Joined: Feb 27, 2010
Posts: 118
Hi Ram thanks alot for your reply,

I have followed your steps in your reply but still facing the same issue.
Malatesh Karabisti
Ranch Hand

Joined: Jul 28, 2010
Posts: 153

There are two ways to get the Connection Object

1)DataSource
2)DriverManager

seems like you are trying both if you are just doing some test application use DriverManager find out the difference between DataSource and DriverManager
Suresh Khant
Ranch Hand

Joined: Feb 27, 2010
Posts: 118
Thanks Malatesh Karabisti for your reply ,

There are two ways to get the Connection Object

1)DataSource
2)DriverManager

seems like you are trying both if you are just doing some test application use DriverManager find out the difference between DataSource and DriverManager





I have already did some small test applications using DriverManager and it worked fine now I want to use DataSource but am still getting this error ........
Suresh Khant
Ranch Hand

Joined: Feb 27, 2010
Posts: 118
Any suggestion............
Rich Burke
Greenhorn

Joined: Nov 30, 2011
Posts: 1
I'm facing the same issue trying to use a DataSource with tomcat6 and mysql. Did you ever figure out the issue?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.sql.SQLException: No suitable driver