Can you show me how to do it.
Thanks.
-----Original Message-----
From: Kris Rasmussen <[EMAIL PROTECTED]>
Sent: Apr 17, 2004 3:09 AM
To: Tomcat Users List <[EMAIL PROTECTED]>,
twcTC <[EMAIL PROTECTED]>
Subject: Re: configure data source
I don't know about web.xml, but if you use a resource
link in the context for the app in server.xml you
should be fine.
Kris
--- twcTC <[EMAIL PROTECTED]> wrote:
> I have the same problem
>
> -----Original Message-----
> From: Niraj Alok <[EMAIL PROTECTED]>
> Sent: Apr 16, 2004 8:04 PM
> To: Tomcat Users List
> <[EMAIL PROTECTED]>
> Subject: configure data source
>
>
> 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]
>
>
>
=== message truncated ===
__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]