Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

java.sql.SQLException: No suitable driver

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 .
 
author
Posts: 4278
34
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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().
 
Suresh Khant
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 247
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Suresh Khant
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ram thanks alot for your reply,

I have followed your steps in your reply but still facing the same issue.
 
Ranch Hand
Posts: 153
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any suggestion............
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm facing the same issue trying to use a DataSource with tomcat6 and mysql. Did you ever figure out the issue?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic