my dog learned polymorphism
The moose likes Servlets and the fly likes Database access from a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Database access from a servlet" Watch "Database access from a servlet" New topic

Database access from a servlet

Sam Tilley
Ranch Hand

Joined: Dec 05, 2001
Posts: 160
Hi, i am trying to access a database from my servlet using Forte and the tomcat server. My servlet works fine but when i try to access the database it does not seem to be able to see it. The top part of my code is below

I placed the database access code in a static block rather than the init method but still get the same error.
My errors are
Error loading driver: java.lang.ClassNotFoundException:
Error connecting to database: java.sql.SQLException: No suitable driver.
Im new to this malarky and so not sure if i have any glaring errors that may be preventing it from working.

Sam Tilley SCJP, SCWCD
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
It can't find your driver for the database. Make sure that the package is in your class path.

I agree. Here's the link:
subject: Database access from a servlet
jQuery in Action, 3rd edition