tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From twcTC <twc7183590...@earthlink.net>
Subject Re: configure data source
Date Sat, 17 Apr 2004 21:53:12 GMT
Can you show me how to do it.

Thanks.

-----Original Message-----
From: Kris Rasmussen <kris_rasmussen@yahoo.com>
Sent: Apr 17, 2004 3:09 AM
To: Tomcat Users List <tomcat-user@jakarta.apache.org>, 
	twcTC <twc7183590290@earthlink.net>
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 <twc7183590290@earthlink.net> wrote:
> I have the same problem
> 
> -----Original Message-----
> From: Niraj Alok <niraj@emacmillan.com>
> Sent: Apr 16, 2004 8:04 PM
> To: Tomcat Users List
> <tomcat-user@jakarta.apache.org>
> 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:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 
> 
> 
=== message truncated ===



	
		
__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message