Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception while connectiing DB through Tomcat

 
santhosh.R gowda
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'


Dear all

Im connectio my SQL DB to my application through JNDI but im getting error as the above

Here is my Server.XML file


And my Web.Xml


And in my code


Please tell me the way to com out of this exception
 
Satya Maheshwari
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the tomcat version you are using? If tomcat 6, you may want to look here: https://sec1.woopra.com/docs/jndi-datasource-examples-howto.html
Additionally I do not see the db name mentioned in the jdbc url in your code.
 
Satya Maheshwari
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a configuration that worked for me:

1.Create context.xml as follows:


2.Copy context.xml to META-INF folder of the WAR
3.Have the following code in servlet:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic