tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peng Tuck Kwok" <pengt...@gmail.com>
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 <veerukrishnan@hotmail.com>
Date:		01/06/2007 19:01


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

myConnection = myDataSource.getConnection();

then executes multiple separate statements

myStatement1 = myConnection.createStatement();
myStatement1.execute();

myStatement2 = myConnection.createStatement();
myStatement2.execute();

then close the connection

myConnection.close();

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

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: http://www.nabble.com/Connection-Pool-and-Connections-tf3853952.html#a10918685
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


Mime
View raw message