Hi,

Question 1: Is your jar containing org.prostgresql.Driver in common/lib?

Question 2: Is your resource defined in a Context or as a GlobalNaming Resource?

Question 3: Version of Tomcat?

Attached is a small servlet which you can use to find out what is happening.

Regards

Eric

-----Original Message-----
From: David Durst [mailto:[EMAIL PROTECTED]]
Sent: Donnerstag, 09. J�nner 2003 12:26
To: [EMAIL PROTECTED]
Subject: Resource issues


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]>

Attachment: DBTest.java
Description: DBTest.java

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to