I am going through the JNDI Datasource example and attempting to apply it
to my situation.
here is the following config in my server.xml
<Resource name="jdbc/mydb" auth="Container" type="javax.sql.Datasource"/>
<ResourceParams name="jdbc/mydb">
<parameter><name>factory</name><value>org.apache.commons.dbcp.BasicDataSourceFactory</value></parameter>
<parameter><name>maxActive</name><value>100</value></parameter>
<parameter><name>maxIdle</name><value>5</value></parameter>
<parameter><name>maxWait</name><value>-1</value></parameter>
<parameter><name>username</name><value>YEAHRIGHT</value></parameter>
<parameter><name>password</name><value>NOSORRY</value></parameter>
<parameter><name>driverClassName</name><value>org.postgresql.Driver</value></parameter>
<parameter><name>url</name><value>jdbc:postgresql://127.0.0.1:5432/larco</value></parameter>
</ResourceParams>
I add the following to my web.xml:
<resource-ref>
<description>postgreSQL Datasource example</description>
<res-ref-name>jdbc/mydb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
When attempting to load the Datasource as follows:
if((cntx = new InitialContext()) == null)
return;
if((ectx = (Context)cntx.lookup("java:comp/env")) == null ){
return;
if((ds = (DataSource)ectx.lookup("jdbc/mydb")) != null)
return;
I get a null on the DataSource.
Can anyone help me out with this???
Thanks,
David Durst
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>