The way connection pooling works, calling close() on the Connection instance
handed out by PooledConnection.getConnection() doesn't necessarily call
close() on the underlying PooledConnection. In the case of XAConnection,
calling close() on the Connection returned by XAConnection.getConnection()
does not equate to commit or rollback on the entire transaction either.

The Connection that is obtained through DataSource.getConnection is a
logical connection that encapsulates a physical connection. The "pool
manager" and PooledConnection/XAConnection implementer manage the mapping
and interactions. JDBC reference has the details of what "manage the mapping
and interactions" equates to in terms of instances, interfaces, and events.

Bob Beauchemin
[EMAIL PROTECTED]

-----Original Message-----
From: Dave Glasser [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 13, 2001 11:41 AM
To: [EMAIL PROTECTED]
Subject: Calling close() on a java.sql.Connection (Monson-Haefel)


In Richard Monson-Haefel's book *Enterprise JavaBeans*, each time he
uses a database Connection that he's gotten from a DataSource, he
calls close() on it when he's finished with it. Am I missing
something, or does this not make sense? It's my understanding that
once close() is called on a Connection, it can never be used again.
How can a container acheive connection pooling this way? Also,
wouldn't calling close() on a connection necessarily commit or roll
back any in-progress transactions on that connection, possibly hosing
any in-progress container-managed transaction?

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to