Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database access from a servlet

 
Sam Tilley
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic