• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating one jdbc configuration file for the entire web applicaton

 
kaustubh kurambhatti
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using netbeans IDE and mysql database for my development in servlet and JSP. I created a java class as it contains all the configuration code to connect to my db. In another java class file i wrote code to retrieve data from db and to display. And it is working absolutely fine. Even I am getting the display of records on the console. But when i am trying connect to db from servlet, I am getting SQLException stating no drivers found. As I want to use single database connection file and use it within the entire web-application.
Please help
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then the Driver has not been loaded. You might want to use a ServletContextListener and do all necessary steps there and then just pick up on those in your servlets.

You might also want to consider using JDBCSupport for your projects. It makes SQL interaction a lot easier.

 
Jinglong Wang
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i think your driver jars can be deployed to your web container(Tomcat may).

open your web container directory. example in tomcat:
x:\tomcat\webapps\your context\WEB-INF\lib\
check your jdbc driver jar is it in this path?
if not, redeploy the project with your ide..
try..
good luck..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic