This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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

Win a copy of Building Microservices this week in the Design forum!
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.

Have you checked out Aspose?
subject: Database access from a servlet
It's not a secret anymore!