Cannot create JDBC driver of class '' for connect URL 'null'
843840Mar 25 2008 — edited Apr 9 2008hi 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..