tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peng Tuck Kwok" <>
Subject RE: Connection Pool and Connections
Date Tue, 09 Oct 2007 07:57:22 GMT
If I recall correctly close from a datasource (not a SQLConnection) will return the connection
to the pool for reuse. In the later this will close the connection to the database.
 To answer your question I'm pretty sure any statement executed within the connection from
the datasource will go to the same database

- original message -
Subject:	Connection Pool and Connections
From:	lightbulb432 <>
Date:		01/06/2007 19:01

When using the tomcat-dbcp DataSource, when my web application code gets a

myConnection = myDataSource.getConnection();

then executes multiple separate statements

myStatement1 = myConnection.createStatement();

myStatement2 = myConnection.createStatement();

then close the connection


Is it possible that myStatement1 and myStatement2 would be run using
different physical database connections, or are they absolutely guaranteed
to be executed using the same connection?

Or is connection pooling only for not actually closing the physical database
connection on myConnection.close(), instead returning it to the connection

A different way of asking this is does connection pooling pool connections
within an application connection (myDataSource.getConnection() and
myConnection.close()), or between application connections?

If this question doesn't make sense, I can clarify. Thanks a lot.
View this message in context:
Sent from the Tomcat - User mailing list archive at

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

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

View raw message