commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Zoetebier <>
Subject Re: DBCP - getting and closing connections and rollback()
Date Sat, 15 Nov 2003 21:50:22 GMT
On Sat, 15 Nov 2003 18:20:13 +0530, Antony Paul <> 

> Hello,
>     I am using DBCP available with TOmcat 4.1.27. I use a static
> synchronised method to get the connection from pool. In DBCP 
> configuration
> no parameter is setting the transaction status(setAutoCommit()). I want 
> to
> know what is happening when getting a connection from pool. Do I have to
> call rollback()  before giving  the connection to client or do DBCP 
> itself
> does this. I feel that calling rollback() causes a performance penalty.

Once the DBCP connection pool is setup you can use a connection like you 
normally do.
There is absolutely no need to use a static method to get a connection 
 from the pool.
The connection pooling is completely transparent from a client point of 
Suppose your pool is called "example".
Get you connection from pool with:
conn = DriverManager.getConnection("jdbc:apache:commons:dbcp:example");

Send connection back to pool with:

All other connection methods work as usual:
if (OK) {
} else {

John Zoetebier
Web site:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message