| Author |
java.sql.SQLException: No suitable driver
|
Suresh Khant
Ranch Hand
Joined: Feb 27, 2010
Posts: 114
|
|
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
Saloon Keeper
Joined: Oct 23, 2005
Posts: 3652
|
|
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: 114
|
|
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: 244
|
|
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: 114
|
|
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: 143
|
|
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: 114
|
|
Thanks Malatesh Karabisti for your reply ,
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: 114
|
|
|
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?
|
 |
 |
|
|
subject: java.sql.SQLException: No suitable driver
|
|
|