commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nikola Milutinovic <Nikola.Milutino...@ev.co.yu>
Subject DBCP + PostgreSQL in Tomcat 4.1.1 problems
Date Wed, 15 May 2002 17:51:34 GMT
Hi all.

I'm having a long history of fighting to get PostgreSQL 7.2.1 to be seen as a 
JNDI resource in Tomcat 4. First it was with Tyrex, now DBCP. Remmy suggested I 
talk to this list.

Basically, I set things up, the way HOW-TO says I should. For testing purposes, 
I have defined two data sources, one to PostgreSQL and the other to Oracle 9i. 
Oracle 9i works, both with Tomcat 4.0x series (Tyrex implemenatation of 
connection pooling) and Tomcat 4.1.1 (DBCP). In the meantime PostgreSQL refuses 
to be incorporated as a JNDI resource.

This is my server.xml for Tomcat:

<Resource name="jdbc/AddressBookDB" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/AddressBookDB">
   <parameter>
     <name>driverClassName</name>
     <value>org.postgresql.Driver</value>
   </parameter>
   <parameter>
     <name>url</name>
     <value>jdbc:postgresql://localhost/www</value>
   </parameter>
   <parameter>
     <name>user</name>
     <value>www</value>
   </parameter>
   <parameter>
     <name>password</name>
     <value>pass</value>
   </parameter>
   <parameter>
     <name>maxActive</name>
     <value>20</value>
   </parameter>
   <parameter>
     <name>maxIdle</name>
     <value>5</value>
   </parameter>
   <parameter>
     <name>maxWait</name>
     <value>10000</value>
   </parameter>
   <parameter>
     <name>validationQuery</name>
     <value>SELECT * FROM org_unit WHERE super_id IS NULL</value>
   </parameter>
</ResourceParams>
<Resource name="jdbc/TestDB" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/TestDB">
   <parameter>
     <name>driverClassName</name>
     <value>oracle.jdbc.driver.OracleDriver</value>
   </parameter>
   <parameter>
     <name>driverName</name>
     <value>jdbc:oracle:thin:@nines.ev.co.yu:1521:ORCL</value>
   </parameter>
   <parameter>
     <name>user</name>
     <value>nikola</value>
   </parameter>
   <parameter>
     <name>password</name>
     <value>amavis</value>
   </parameter>
</ResourceParams>

I'm using PosgreSQL JDBC driver which has org.postgresql.xa.* classes, which 
have implementation classes for Tyrex (is that of relevance?). It also has a 
org.postgresql.PostgresqlDataSource.class.

The result I'm getting is that for Oracle, Tomcat forms a DataSource object and 
it has a reference in JNDI. The resource for PostgreSQL, remains untouched:

AddressBookDB: org.apache.naming.ResourceRef:ResourceRef[
    className=javax.sql.DataSource,
    factoryClassLocation=null,
    factoryClassName=org.apache.naming.factory.ResourceFactory,
      {type=scope,content=Shareable},
      {type=auth,content=Container},
      {type=validationQuery,content=SELECT * FROM org_unit},
      {type=user,content=www},
      {type=maxWait,content=10000},
      {type=maxActive,content=20},
      {type=password,content=pass},
      {type=url,content=jdbc:postgresql://localhost/www},
      {type=driverClassName,content=org.postgresql.Driver},
      {type=maxIdle,content=5}
]

This, I think, means that the factory for DataSource threw an exception while 
trying to set things up and that Tomcat gave up on "converting" that JNDI entry 
to a DataSource reference.

QUESTIONS
---------

Anyone got it to work?
What type of driver do I need for this to work?
What classes must it have?
How could I test this in "dry-dock" (a standalone application), instead of Tomcat?

Nix.


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message