> I use the JNDI based connection pool with Postgres quite successfully.
> You will need to have postgresql.jar in $CATALINA_HOME/common/lib, and a
> server.xml configuration something like this:
> ...
> One Postgres-specific note is that you have to start the "postmaster"
> application listening for TCP socket connections (defaults to port 5432),
> as described in the Postgres docs.

Can you think of any oracle-specific notes? I get nothing but null instead
of DataSource object I am expecting.

I have following in my my server.xml

 <Context path="/mycontext" docBase="mycontext" debug="0">
  <Resource name="jdbc/DB" auth="Container"
   type="javax.sql.DataSource"/>

  <ResourceParams name="jdbc/DB">
   <parameter>
    <name>driverClassName</name>
    <value>oracle.jdbc.driver.OracleDriver</value>
   </parameter>
   <parameter>
    <name>driverName</name>
    <value>jdbc:oracle:thin:@127.0.0.1:1521:dbname</value>
   </parameter>
   <parameter>
    <name>passwod</name>
    <value>dbpassword</value>
   </parameter>
   <parameter>
    <name>user</name>
    <value>dbuser</value>
   </parameter>
  </ResourceParams>
 </Context>


In web.xml I have following resource-ref defined:

 <resource-ref>
  <description>
  Resource reference to a factory for javax.sql.DataSource
  instances that may be used for talking to a particular
  database that is configured in the server.xml file.
  </description>
  <res-ref-name>jdbc/DB</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
 </resource-ref>

And code in my servlet looks like this:

  DataSource ds = null;
  Context initCtx = new InitialContext();
  Context envCtx = (Context)initCtx.lookup( "java:comp/env" );
  ds = (DataSource)envCtx.lookup( "jdbc/DB" );

The problem is that returned datasource is always null.

If I do something like this in my servlet:

   DriverManager.registerDriver( new oracle.jdbc.driver.OracleDriver() );

   connection = DriverManager.getConnection(
    "jdbc:oracle:thin:@127.0.0.1:1521:dbname",
    "dbuser", "dbpassword"
   );

... then I can get connection just fine.

What I want to get is a pooled connection. Is it possible with tomcat 4?

with best regards,
Taavi



--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to