Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Cannot create JDBC driver of class '' for connect URL 'null'

843840Mar 25 2008 — edited Apr 9 2008
hi to all,
Exactly i am working with jndi, tomcat and datasource...
Below is the exception which i got...
Cannot connect to database serverorg.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
[]


Here is Resource and ResourceParams tags which i have given in server.xml of tomcat 5.5 and these tags i have given in between <host> tag of server.xml.

server.xml*

<DefaultContext>
<Resource name="jdbc/DBTest" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/DBTest">
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/test</value>
</parameter>
<parameter>
<name>username</name>
<value>testuser</value>
</parameter>
<parameter>
<name>password</name>
<value>testpass</value>
</parameter>
</ResourceParams>
</DefaultContext>

Below is the web.xml of my web application which contains <res-ref> tag:

web.xml_

<resource-ref>
<res-ref-name>jdbc/DBTest</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>


Here is my Java code for JNDI to look up a data source:

InitialContext initCtx = new InitialContext();
DataSource dataSource = (DataSource)initCtx.lookup("java:comp/env/jdbc/DBTest");
conn = dataSource.getConnection();


Please help me to sort out this problem.. Because of this problem... I am not able to proceed further to implement my application... i have tried everything but nothing is happenning... Same kind of exception i am getting.. Please i kindly, sincerely request all of you who belongs to this forum.. Thanks in advance... Please Please try to give solution for this exception..
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2008
Added on Mar 25 2008
7 comments
483 views