wood burning stoves 2.0*
The moose likes JDBC and the fly likes MySQL Tomcat JDBC DataSource problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MySQL Tomcat JDBC DataSource problem" Watch "MySQL Tomcat JDBC DataSource problem" New topic
Author

MySQL Tomcat JDBC DataSource problem

Mahesh Chandran
Greenhorn

Joined: Mar 23, 2011
Posts: 20
Hi all,

I am trying to setup a MySQL DataSource for Hibernate in Tomcat 6.0.6 application server. I am following the example from net.

The following are the steps that I did:

1. Copied MySQL JDBC Driver to CATALINA_LIB/lib folder. (Tried copying it to CATALINA_LIB/common/lib as well - same result).
2. In application Context.xml created the following entry for Resource:


3. Created ResourceRef in web.xml as follows:



4. Then added the following code in index.jsp:


I get the exception:




I know that this error has been discussed over and over again. I think I am following most of the suggestions. But don't know where I am getting it wrong. Can anyone point out the mistake that I am doing here.

Thanks
Mahesh
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

Tomcat 6 has changed the way resources are handled. Instead of a Resource element and a separate ResourceParams element they go into one element now:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Mahesh Chandran
Greenhorn

Joined: Mar 23, 2011
Posts: 20
Hi Rob,

I tried this out myself too. It works now like magic.

Appreciate your inputs

Thanks
Mahesh
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

You're welcome. I ran into the same problem when switching from Tomcat 5 to Tomcat 6, so I know how frustrating this issue can be.
 
jQuery in Action, 2nd edition
 
subject: MySQL Tomcat JDBC DataSource problem
 
Similar Threads
Error JSP - Tomcat
Need help with JNDI connection to tomcat
help in my first DBCP
Doubt in JSP Custom tags (Simple Tag) in Dynamic Drop Down
Connection Polling in Oracle 10g Using NetBeans ID