tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julio J. Suárez Salinero" <>
Subject OracleConnectionPoolDataSource
Date Wed, 18 Jul 2007 12:33:31 GMT
I'm Trying to connect a JSP tomcat-based application to Oracle using 
OracleConnectionPoolDataSource and related classes. I have used 
javax.sql.DataSource an it did work fine. I have made changes I need for 
using that classes and when I get the DataSource it throws exception 
"javax.naming.NamingException: Cannot create resource instance".

Changes I have made are these:

In context.xml:

<Context path="/test" docBase="test" debug="0"
reloadable="true" >
    name="jdbc/test" auth="Container"
    maxActive="0" maxIdle="-1" maxWait="-1"
    removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
    username="test" password="test"
    url="jdbc:oracle:thin:@" />

In web.xml (only resource-ref):


Code that creates connection:

 initCtx = new InitialContext();
 ctx = (Context) initCtx.lookup("java:/comp/env");
 fuenteDatos = (OracleConnectionPoolDataSource) ctx.lookup("/jdbc/test");
 PooledConnection pc = fuenteDatos.getPooledConnection();
 con = pc.getConnection();

I have searched in google and found some examples that use 
oracle.jdbc.driver.OracleDriver in driverClassName. I have also tried 
this option with the same results. I suppose bug is elsewhere.

I have tried to create DataSource instance in the code instead of get it 
from resource. Doing this it drops no error and page works, but I don't 
know how can I control maximun number of pooled connections. This is the 
code I have used for that:

 initCtx = new InitialContext();
 OracleConnectionPoolDataSource fuenteDatos = new 
 initCtx.rebind(DS, fuenteDatos);
 pc = fuenteDatos.getPooledConnection();

But it creates only one connection and doesn't allow two users to log in 
at the same time.

Please. I need help.

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message