Hi All,
I am trying to obtain a connection using DataSource
in Tomcat5 .
I get the following error :
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of
class '' for connect URL 'null', cause:
java.sql.SQLException: No suitable driver
My source code is :
Context ctx = new InitialContext();
if (ctx == null)
throw new Exception("No context got! Exception");
System.out.println("got ctx");
DataSource ds =
(DataSource) ctx.lookup("java:comp/env/jdbc/hypersonic");
if(ds == null)
throw new Exception("No ds got! Exception");
else
{
System.out.println("got ds");
Connection con = ds.getConnection();
if(con != null)
....
...
}
My server.xml looks like :
<GlobalNamingResources>
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<Resource auth="Container" description="User database that can be updated
and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase"/>
<Resource name="hypersonic" type="javax.sql.DataSource"/>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>
<ResourceParams name="hypersonic">
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>password</name>
<value></value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:hsqldb:hsql://localhost:1701</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.hsqldb.jdbcDriver</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
<parameter>
<name>username</name>
<value>sa</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
My web.xml contains:
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/hypersonic</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Even if i comment this entry in web.xml the error is still the same.
Can any one please tell me what am I doing wrong??
Regards,
Niraj
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]