Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about database connectivity

 
phani bhushan reddy
Greenhorn
Posts: 27
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having problem when i was try to connect the database, while using servlets. It was throwing an exception called ClassNotFoundException, actually i know the meaning of the exception but it was working when i am doing simple applications and also in the swing applications but it was making problem when it comes to servlets only, please tell me the solution for this
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You didn't mention which class was not found -the exception should tell you that- but I'm guessing that it is the JDBC driver. Did you put the jar file that contains the driver into the WEB-INF/lib directory of your web application?
 
mohan kumar r
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can also add jar in CLASSPATH entry of the server you are using.
for example,if you are using weblogic server and Oracel DB,
add classes12.jar to CLASSPATH entry in driver:\bea\user_projects\domains\mydomain\startManagedWebLogic.cmd(or .sh if it is in unix).
restart the server
deploy the application
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat ignores the CLASSPATH environment variable.
You might want to check this for more information related to Tomcat's classloading hierarchy.

As Ulf said , you have to put the driver classes jar in WEB-INF/lib folder.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic