You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sorin Juco <ju...@gmail.com> on 2007/05/30 09:41:18 UTC

JDBC resource with custom connection pool factory

Hello,

I want to create a JDBC resource wich represents a connection pool to an
Oracle server. By default Tomcat uses DBCP to provide the connection pool
implementation. My problem is that I want to execute some custom code each
time I get a connection from the pool and also each time I release the
connection back to the pool. 
Does this mean that I have to implement my own conn-pool factory? Or can I
do this using DBCP. I couldn't find an answer anywhere. Can someone point me
to a tutorial! 

Thanx.
-- 
View this message in context: http://www.nabble.com/JDBC-resource-with-custom-connection-pool-factory-tf3838781.html#a10869019
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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: JDBC resource with custom connection pool factory

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

I use this Resource:

<Resource name="RESOURCE_NAME"
          auth="Container"
          type="oracle.jdbc.pool.OracleDataSource"
          factory="oracle.jdbc.pool.OracleDataSourceFactory"
          user="ORACLEUSER"
          password="ORACLEPASS"
          driverClassName="oracle.jdbc.driver.OracleDriver"
          url="jdbc:oracle:thin:@192.168.100.99:1521:orcl"
          maxActive="20" maxIdle="10" maxwait="-1"/>

There is OracleDataSourceFactory in ojdbc14.jar.

Regards,
Zdenek

On 5/30/07, Sorin Juco <ju...@gmail.com> wrote:
>
> Hello,
>
> I want to create a JDBC resource wich represents a connection pool to an
> Oracle server. By default Tomcat uses DBCP to provide the connection pool
> implementation. My problem is that I want to execute some custom code each
> time I get a connection from the pool and also each time I release the
> connection back to the pool.
> Does this mean that I have to implement my own conn-pool factory? Or can I
> do this using DBCP. I couldn't find an answer anywhere. Can someone point me
> to a tutorial!
>
> Thanx.
> --
> View this message in context: http://www.nabble.com/JDBC-resource-with-custom-connection-pool-factory-tf3838781.html#a10869019
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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: JDBC resource with custom connection pool factory

Posted by Sorin Juco <ju...@gmail.com>.
Thanx for the answers. 

I just realized that what I want to do is more complex. I use Hibernate and
pass the jdbc resource to the Hibernate configuration. Oracle has a
temporary table for each session to the database in which you can store 2
varchar arguments for monitoring purposes ( in my case the module and method
that acquired the connection ). The problem is that I have to pass the
arguments at the moment I acquire the connection in Hibernate so extending
the factory won't help. But this question is for a Hibernate mailing list
most probably.



ROOKIE-4 wrote:
> 
> To execute custom code while getting a connection u can extend the
> connection factory and mention that class as the factory for ur resource,
> I dont think we close connections using the factory, so maybe u can write
> a wrapper around Connection.close() method. 
> 
> ----- Original Message ----
> From: Sorin Juco <ju...@gmail.com>
> To: users@tomcat.apache.org
> Sent: Wednesday, May 30, 2007 1:11:18 PM
> Subject: JDBC resource with custom connection pool factory
> 
> 
> Hello,
> 
> I want to create a JDBC resource wich represents a connection pool to an
> Oracle server. By default Tomcat uses DBCP to provide the connection pool
> implementation. My problem is that I want to execute some custom code each
> time I get a connection from the pool and also each time I release the
> connection back to the pool. 
> Does this mean that I have to implement my own conn-pool factory? Or can I
> do this using DBCP. I couldn't find an answer anywhere. Can someone point
> me
> to a tutorial! 
> 
> Thanx.
> -- 
> View this message in context:
> http://www.nabble.com/JDBC-resource-with-custom-connection-pool-factory-tf3838781.html#a10869019
> Sent from the Tomcat - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 
> 
> 
> 
>        
> ____________________________________________________________________________________Building
> a website is a piece of cake. Yahoo! Small Business gives you all the
> tools to get online.
> http://smallbusiness.yahoo.com/webhosting 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/JDBC-resource-with-custom-connection-pool-factory-tf3838781.html#a10870039
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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