db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Narayanan <V.Naraya...@Sun.COM>
Subject Re: getconnection error using Derby and tomcat6/jndi
Date Wed, 27 Feb 2008 07:50:13 GMT
Dockery, Michael E SFC NG NG NGB wrote:
> I am trying to get derby working
> on tomcat6 via jndi
>
>
> my context.xml looks like this:
> <?xml version='1.0' encoding='utf-8'?>
> <Context path="/testApp" docBase="testApp" antiJARLocking="true">
>   <!-- ensure the db server is started and that tomcat can find the db 
> driver -->
> <Resource    name="jdbc/derbyDB" auth="Container"
>         type="javax.sql.DataSource"
>        driverClassName="org.apache.derby.jdbc.ClientDriver"
>       url="jdbc:derby://192.168.1.100:1527/setupDB"
>         maxActive="10"  maxIdle="5"        />
> </Context>
>
>
>
> my web.xml looks like this
> ...
> <resource-ref>
>   <description>Setup Database</description>
>   <res-ref-name>jdbc/derbyDB</res-ref-name>
>   <res-type>javax.sql.DataSource</res-type>
>   <res-auth>Container</res-auth>
> </resource-ref>
>
> ...
>
> my java code gets the datasource from jndi just fine
>  envCtx = (javax.naming.Context) initCtx.lookup("java:comp/env");
>  ds=(DataSource)envCtx.lookup("jdbc/derbyDB");
>
> but it fails when i try to getConnection
>   conn = ds.getConnection();
>
>
>
>
> i am not sure what i am doing wrong here.
>
> Any ideas?
>
> Thank you
> Michael
>
>
> ps:
> note: the commandline ij tool works fine also:
>   C:\Documents and Settings\Lisa>ij
>   ij version 10.3
>   ij> connect 'jdbc:derby://192.168.1.100/setupDB';
>   ij> show tables;
>   TABLE_SCHEM         |TABLE_NAME                    |REMARKS
>   
> ------------------------------------------------------------------------
>   SYS                 |SYSALIASES                    |
> ...
>
Do you have a stack trace of the failure ?

Not sure but I think this link matches your requirement perfectly

http://www.pintux.it/docs/Derby-Tomcat-en.pdf

Narayanan

Mime
View raw message