tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julio J. SuƔrez Salinero" <ju...@miracle-soft.com>
Subject Re: OracleConnectionPoolDataSource
Date Thu, 19 Jul 2007 14:43:14 GMT
I have get it to work from a context resource. I've had to specify a 
factory attribute. Currently context.xml is this:

<Context path="/test" docBase="test" debug="0" reloadable="true" >
<Resource name="jdbc/test" auth="Container"
type="oracle.jdbc.pool.OracleConnectionPoolDataSource"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
maxActive="0" maxIdle="-1" maxWait="-1"
removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@192.168.1.47:1521:GLOBALDB" />
</Context>

User and password doesn't work in context.xml. I have used a 
getPooledConnection overload:

Context ctx = (Context) initCtx.lookup("java:/comp/env");
OracleConnectionPoolDataSource fuenteDatos = 
(OracleConnectionPoolDataSource) ctx.lookup("/jdbc/test");
pc = fuenteDatos.getPooledConnection(dbUser, dbPassword);
 
dbUser and dbPassword are loaded from a configuration file.

Now, I can set pool maximum size in context.xml, but it still creates 
only one connection and doesn't allow two users to log in at the same time.

Perhaps I am reusing PooledConnection instead of Connection???

Christopher Schultz escribiĆ³:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Barry,
>
> Propes, Barry L wrote:
>   
>> are you importing the following packages?
>>
>> You maybe should.
>>
>> import javax.naming.Context;
>> import javax.naming.InitialContext;
>> import javax.naming.NamingException;
>>     
>
> Erm.... if he weren't importing those packages, his code wouldn't
> compile. The OP has a problem with /configuration/:
>
>   
>>>> 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".
>>>>         
>
> Something is wrong in here:
>
>   
>>>> <Resource
>>>> name="jdbc/test" auth="Container"
>>>> type="oracle.jdbc.pool.OracleConnectionPoolDataSource"
>>>>         
>
> I wonder if Tomcat doesn't really know what to do with this "type". Why
> do you want to use the OracleConnectionPoolDataSource specifically?
>
>   
>>>> driverClassName="oracle.jdbc.pool.OracleConnectionPoolDataSource"
>>>>         
>
> This is probably wrong. This class is the same as the one you used for
> "type", which probably extends javax.sql.DataSource. You want something
> that implements java.sql.Driver. Re-check the Oracle documentation to
> see what driver class you should really be using.
>
> - -chris
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGnrp09CaO5/Lv0PARAmwgAJ9015dCPWCJvYjYwLBSkPKcAYWuCgCgtrCm
> ef63dCd2d0OJUHKoxR0X9Xc=
> =u7e9
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message