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

unable to connect to mysql database from JSP

 
Joel Karimpil
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have set the classpath of the driver ;
the filename is mysql-connector-java-3.1.0-alpha-bin.jar
i am using jakarta-tomcat as my web server

i get a driver class not found error
the driver i have specified is org.gjt.mm.mysql.Driver

plz help
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put mysql-connector-java-3.1.0-alpha-bin.jar in Tomcat's lib directory.
 
Joel Karimpil
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i searched and i found many lib directories.
which lib directory must i place it in?
 
Joel Karimpil
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also, has a driver version to be compatible with a db version ?
i mean if the db is a new version and if the driver is old, is it still fine?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Joel Karimpil:
i searched and i found many lib directories.
which lib directory must i place it in?


The real answer is 'it depends', although the short answer is that the best place is the <context>/WEB-INF/lib directory. The reason this is the best is that it gives the code the smallest scope within the app server.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Joel Karimpil:
also, has a driver version to be compatible with a db version ?
i mean if the db is a new version and if the driver is old, is it still fine?


More likely you have an old database version and a newer driver version, but they tend to be backwards-compatible and I've never had a problem with MySQL.
 
Joel Karimpil
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks,

after placing the driver in WEB-INF\lib and setting the classpath it's working pretty fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic