• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

about database connectivity

 
Greenhorn
Posts: 27
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
They worship nothing. They say it's because nothing is worth fighting for. Like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic