You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Julio J. Suárez Salinero" <ju...@miracle-soft.com> on 2007/07/18 14:33:31 UTC

OracleConnectionPoolDataSource

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" >
 <Resource
    name="jdbc/test" auth="Container"
    type="oracle.jdbc.pool.OracleConnectionPoolDataSource"
    maxActive="0" maxIdle="-1" maxWait="-1"
    removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
    username="test" password="test"
    driverClassName="oracle.jdbc.pool.OracleConnectionPoolDataSource"
    url="jdbc:oracle:thin:@192.168.1.109:1521:GLOBALDB" />
</Context>

In web.xml (only resource-ref):

<resource-ref>
 <res-ref-name>jdbc/test</res-ref-name>
 <res-type>oracle.jdbc.pool.OracleConnectionPoolDataSource</res-type>
 <res-auth>Container</res-auth>
</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 
OracleConnectionPoolDataSource();
 fuenteDatos.setDataSourceName("oracle.jdbc.pool.OracleConnectionPoolDataSource");
 fuenteDatos.setURL(dbURL);
 fuenteDatos.setDescription(DS);
 fuenteDatos.setUser(dbUsuario);
 fuenteDatos.setPassword(dbPassword);
 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: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: OracleConnectionPoolDataSource

Posted by "Julio J. Suárez Salinero" <ju...@miracle-soft.com>.
Zdeněk Vráblík escribió:
> Hi,
>
> There is error in driverClassName.
>
> Try use this:
> driverClassName="oracle.jdbc.driver.OracleDriver"
>
Thanks, but I already have tested that with the same results.
> Zdenek
>
> On 7/18/07, "Julio J. Suárez Salinero" <ju...@miracle-soft.com> wrote:
>> 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" >
>> <Resource
>> name="jdbc/test" auth="Container"
>> type="oracle.jdbc.pool.OracleConnectionPoolDataSource"
>> maxActive="0" maxIdle="-1" maxWait="-1"
>> removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
>> username="test" password="test"
>> driverClassName="oracle.jdbc.pool.OracleConnectionPoolDataSource"
>> url="jdbc:oracle:thin:@192.168.1.109:1521:GLOBALDB" />
>> </Context>
>>
>> In web.xml (only resource-ref):
>>
>> <resource-ref>
>> <res-ref-name>jdbc/test</res-ref-name>
>> <res-type>oracle.jdbc.pool.OracleConnectionPoolDataSource</res-type>
>> <res-auth>Container</res-auth>
>> </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
>> OracleConnectionPoolDataSource();
>> fuenteDatos.setDataSourceName("oracle.jdbc.pool.OracleConnectionPoolDataSource"); 
>>
>> fuenteDatos.setURL(dbURL);
>> fuenteDatos.setDescription(DS);
>> fuenteDatos.setUser(dbUsuario);
>> fuenteDatos.setPassword(dbPassword);
>> 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: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 


---


*Julio Javier Suárez Salinero*

*Departamento de programación*

AVISO LEGAL: Este mensaje contiene información confidencial para ser 
leída exclusivamente por el destinatario. Su contenido no constituye un 
compromiso para el remitente salvo ratificación escrita por ambas 
partes. Queda prohibida la reproducción, publicación, divulgación, total 
o parcial del mensaje así como el uso no autorizados por el emisor. En 
caso de recibir el mensaje por error se ruega su comunicación al 
remitente lo antes posible.

LEGAL WARNING: This message contains confidential information for the 
exclusive use of the recipient. Its contents do not constitute a 
commitment by the sender except where provided for in a signed agreement 
between both parties. Any unauthorised disclosure, use or dissemination, 
either whole or partial, is prohibited. If you are not the intended 
recipient of the message, please notify.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: OracleConnectionPoolDataSource

Posted by Zdeněk Vráblík <zd...@vrablik.org>.
Hi,

There is error in driverClassName.

Try use this:
 driverClassName="oracle.jdbc.driver.OracleDriver"

Zdenek

On 7/18/07, "Julio J. Suárez Salinero" <ju...@miracle-soft.com> wrote:
> 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" >
>  <Resource
>     name="jdbc/test" auth="Container"
>     type="oracle.jdbc.pool.OracleConnectionPoolDataSource"
>     maxActive="0" maxIdle="-1" maxWait="-1"
>     removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
>     username="test" password="test"
>     driverClassName="oracle.jdbc.pool.OracleConnectionPoolDataSource"
>     url="jdbc:oracle:thin:@192.168.1.109:1521:GLOBALDB" />
> </Context>
>
> In web.xml (only resource-ref):
>
> <resource-ref>
>  <res-ref-name>jdbc/test</res-ref-name>
>  <res-type>oracle.jdbc.pool.OracleConnectionPoolDataSource</res-type>
>  <res-auth>Container</res-auth>
> </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
> OracleConnectionPoolDataSource();
>  fuenteDatos.setDataSourceName("oracle.jdbc.pool.OracleConnectionPoolDataSource");
>  fuenteDatos.setURL(dbURL);
>  fuenteDatos.setDescription(DS);
>  fuenteDatos.setUser(dbUsuario);
>  fuenteDatos.setPassword(dbPassword);
>  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: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: OracleConnectionPoolDataSource

Posted by "Julio J. Suárez Salinero" <ju...@miracle-soft.com>.
Caldarale, Charles R escribió:
>> From: "Julio J. Suárez Salinero" [mailto:julio@miracle-soft.com] 
>> Subject: OracleConnectionPoolDataSource 
>>
>> I'm Trying to connect a JSP tomcat-based application to Oracle using 
>> OracleConnectionPoolDataSource and related classes.
>>     
>
> Don't suppose you'd be interested in telling us the version of Tomcat you're using?
>
>   
You're right. Sorry. I'm using Apache Tomcat 5.5.23 for windows, Java 
JDK 1.5.0_05 and Oracle 9i Release 2 (9.2.0.1.0). All for windows.
>> In context.xml:
>> <Context path="/test" docBase="test" debug="0" reloadable="true" >
>>     
>
> If you're on Tomcat 5.0 or above, remove the path and docBase attributes; they may not be used when the <Context> element is in META-INF/context.xml.  (That won't solve your problem, but let's get the obvious errors corrected first.)
>
>  - Chuck
>
>   
Thanks for the advice. I'll take note.
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>   

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: OracleConnectionPoolDataSource

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: "Julio J. Suárez Salinero" [mailto:julio@miracle-soft.com] 
> Subject: OracleConnectionPoolDataSource 
> 
> I'm Trying to connect a JSP tomcat-based application to Oracle using 
> OracleConnectionPoolDataSource and related classes.

Don't suppose you'd be interested in telling us the version of Tomcat you're using?

> In context.xml:
> <Context path="/test" docBase="test" debug="0" reloadable="true" >

If you're on Tomcat 5.0 or above, remove the path and docBase attributes; they may not be used when the <Context> element is in META-INF/context.xml.  (That won't solve your problem, but let's get the obvious errors corrected first.)

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org