aspose file tools*
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
Author

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: com.microsoft.jdbc.sqlserver.SQLServerDriver
and
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.
Thanks
Sam


Sam Tilley SCJP, SCWCD
Dave Vick
Ranch Hand

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


Dave
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Database access from a servlet