You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Keith Thomas <ke...@gmail.com> on 2009/01/16 21:22:35 UTC

Need to turn off connection pooling in Tomcat

The security for the data within the legacy database I am using is entirely
baked into the restriction that every user has their own database
connection. As far as I can tell it is not possible to use connection
pooling a retain secure access to the data without an awful lot of re-work. 

At the moment I am using a new DB connection for every DB access my app
makes. Later I may implement my own database polling but either way it will
be my code initiating connection requests not Tomcat's. 

Tomcat comes configured with DBCP which in turn seems to want to manage my
database connections. At the bottom of this posting is a stacktrace fragment
indicating connection requests being made related to connection pooling.

Ideally, I'd just like to be able to turn off connection pooling. Setting
maxactive to zero does not seem to do this. Setting maxactive to 1 seems to
indicate I want a connection pool of size 1 , which is no use either. If
DBCP cannot be configured just to "stay out of it" is it possible to
reconfigure Tomcat to provide JNDI database connectivity without using DBCP?

at
org.apache.tomcat.dbcp.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38) 
        at
org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294) 
        at
org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:974) 
        at
org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96) 
        at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880) 
        ... 16 more 

-- 
View this message in context: http://www.nabble.com/Need-to-turn-off-connection-pooling-in-Tomcat-tp21507734p21507734.html
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


RE: Need to turn off connection pooling in Tomcat

Posted by Keith Thomas <ke...@gmail.com>.
Yes each user has their own db connection. I am using Hibernate, I wonder if
this is a problem with Hibernate wanting to do connection pooling on my
behalf. Thanks, you have given me something to go on.



Wes Clark wrote:
> 
> First off, do you mean each user has his or her own database user id?
> 
> If not, you should be able to configure Tomcat with a DataSource without
> configuring a DBCP connection pool around it.  You'd get the DataSource
> using JNDI, and then call getConnection() on the DataSource, which would
> give you a new connection each time. 
> 
> -----Original Message-----
> From: Keith Thomas [mailto:keith.thomas@gmail.com] 
> Sent: Friday, January 16, 2009 12:23 PM
> To: user@commons.apache.org
> Subject: Need to turn off connection pooling in Tomcat
> 
> 
> The security for the data within the legacy database I am using is
> entirely baked into the restriction that every user has their own
> database connection. As far as I can tell it is not possible to use
> connection pooling a retain secure access to the data without an awful
> lot of re-work. 
> 
> At the moment I am using a new DB connection for every DB access my app
> makes. Later I may implement my own database polling but either way it
> will be my code initiating connection requests not Tomcat's. 
> 
> Tomcat comes configured with DBCP which in turn seems to want to manage
> my database connections. At the bottom of this posting is a stacktrace
> fragment indicating connection requests being made related to connection
> pooling.
> 
> Ideally, I'd just like to be able to turn off connection pooling.
> Setting maxactive to zero does not seem to do this. Setting maxactive to
> 1 seems to indicate I want a connection pool of size 1 , which is no use
> either. If DBCP cannot be configured just to "stay out of it" is it
> possible to reconfigure Tomcat to provide JNDI database connectivity
> without using DBCP?
> 
> at
> org.apache.tomcat.dbcp.dbcp.DriverConnectionFactory.createConnection(Dri
> verConnectionFactory.java:38) 
>         at
> org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(Poolabl
> eConnectionFactory.java:294) 
>         at
> org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericO
> bjectPool.java:974) 
>         at
> org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataS
> ource.java:96) 
>         at
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSourc
> e.java:880) 
>         ... 16 more 
> 
> --
> View this message in context:
> http://www.nabble.com/Need-to-turn-off-connection-pooling-in-Tomcat-tp21
> 507734p21507734.html
> Sent from the Commons - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Need-to-turn-off-connection-pooling-in-Tomcat-tp21507734p21508723.html
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


RE: Need to turn off connection pooling in Tomcat

Posted by Wes Clark <wc...@guidewire.com>.
First off, do you mean each user has his or her own database user id?

If not, you should be able to configure Tomcat with a DataSource without
configuring a DBCP connection pool around it.  You'd get the DataSource
using JNDI, and then call getConnection() on the DataSource, which would
give you a new connection each time. 

-----Original Message-----
From: Keith Thomas [mailto:keith.thomas@gmail.com] 
Sent: Friday, January 16, 2009 12:23 PM
To: user@commons.apache.org
Subject: Need to turn off connection pooling in Tomcat


The security for the data within the legacy database I am using is
entirely baked into the restriction that every user has their own
database connection. As far as I can tell it is not possible to use
connection pooling a retain secure access to the data without an awful
lot of re-work. 

At the moment I am using a new DB connection for every DB access my app
makes. Later I may implement my own database polling but either way it
will be my code initiating connection requests not Tomcat's. 

Tomcat comes configured with DBCP which in turn seems to want to manage
my database connections. At the bottom of this posting is a stacktrace
fragment indicating connection requests being made related to connection
pooling.

Ideally, I'd just like to be able to turn off connection pooling.
Setting maxactive to zero does not seem to do this. Setting maxactive to
1 seems to indicate I want a connection pool of size 1 , which is no use
either. If DBCP cannot be configured just to "stay out of it" is it
possible to reconfigure Tomcat to provide JNDI database connectivity
without using DBCP?

at
org.apache.tomcat.dbcp.dbcp.DriverConnectionFactory.createConnection(Dri
verConnectionFactory.java:38) 
        at
org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(Poolabl
eConnectionFactory.java:294) 
        at
org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericO
bjectPool.java:974) 
        at
org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataS
ource.java:96) 
        at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSourc
e.java:880) 
        ... 16 more 

--
View this message in context:
http://www.nabble.com/Need-to-turn-off-connection-pooling-in-Tomcat-tp21
507734p21507734.html
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org