I tried the configuration that you are using and could not get it to work.
Is the databaseName in server.xml the service name (SID)?  I tried using the
SID and the tns name there and still got a null when calling to retrieve the
datasource or PooledConnectionDataSource.  Tyrex is working just fine, I
just can't get Oracle pooled connections.  Is there anything else needed
besides what you added in this email?

tks
Bryan

-----Original Message-----
From: Eichfelder, Frank [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 16, 2002 7:12 AM
To: [EMAIL PROTECTED]
Subject: Problems with Oracle/JNDI/ConnectionPoolDataSource


Hi,

I finally managed to get the JNDI-DataSource to work with Tomcat 4.0.3.
Here the setting of server.xml:

<Resource name="jdbc/BuergerPortalDb" auth="Container"
                  type="javax.sql.DataSource"/>
          <ResourceParams name="jdbc/BuergerPortalDb">

<parameter><name>factory</name><value>oracle.jdbc.pool.OracleDataSourceFacto
ry</value></parameter>
            <parameter><name>user</name><value>xxx</value></parameter>
            <parameter><name>password</name><value>xxx</value></parameter>

<parameter><name>driverType</name><value>thin</value></parameter>

<parameter><name>serverName</name><value>server</value></parameter>

<parameter><name>portNumber</name><value>port</value></parameter>

<parameter><name>databaseName</name><value>dbName</value></parameter>
          </ResourceParams>

Now, I added the following in my web.xml:

<resource-ref>
    <description>description</description>
    <res-ref-name>jdbc/BuergerPortalDb</res-ref-name>
    <res-type>oracle.jdbc.pool.OracleConnectionPoolDataSource</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
  </resource-ref>

And finally, in the Java-File I added:

        Context initCtx = new InitialContext();

      Context envCtx = (Context) initCtx.lookup("java:comp/env");
      ConnectionPoolDataSource cpds = (ConnectionPoolDataSource)
envCtx.lookup("jdbc/BuergerPortalDb");

      PooledConnection pconn = cpds.getPooledConnection("xxx", "xxx");

      Connection conn = pconn.getConnection();

And, you won't believe it, it really works!!!

But there's one odd point I want to correct:
The User/Password-Setting in the server.xml file is always ignored - I have
always to pass these two parameters when calling
getPooledConnection("name", "password");

If I call getPooledConnection() without these two parameters, I get some
nice exceptions.

Now it is quite tedious to store the user/password-combination in the
source-code, if you could store it in the server.xml...

Has anybody an idea how to make it work via server.xml only?

Frank

mailto:[EMAIL PROTECTED]

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


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

Reply via email to