I had problems earlier getting a Global Naming Resource database connection pool to 
work with my Oracle db. The only reply I got was that someone else had the same 
problem!

I now have it working, so for those interested, here is the HOW TO:

When defining the parameters for the db pool (say TESTdb) ensure that the maxActive 
parameter is not set too high, i.e. that Oracle has enough connections available for 
the pool (Oracle config parameter max_connections). Mine was set to 100 in server.xml, 
and when the pool tried to establish itself, it just sat and waited for 100 
connections to become available!

Every app that wants to use the connection pool should have a Context entry in 
server.xml containing a ResourceLink to the name of the pool.

<ResourceLink name="testDb" global="jdbc/TESTdb" type="javax.sql.DataSource"/>

The application can then connect using:
      
        Context ctx = null;
        ctx = new InitialContext();
      Context envCtx = (Context) ctx.lookup("java:/comp/env/");
        DataSource ds = (DataSource) envCtx.lookup("/testDb");
        Connection conn = ds.getConnection();

No entries are required in the application web.xml to reference the resource.

Have Fun!


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

Reply via email to