commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pruitt, Byron S" <steve.pru...@hp.com>
Subject [dbcp] inconsistently set autocommit
Date Wed, 16 Sep 2015 17:35:28 GMT
My usual process for learning something is a quick prototype.  For setting up a driver pool
with autocommit = false, I implemented the little quickie prototype below.

Properties dbProp = new Properties();
dbProp.put("user", "aUser");
dbProp.put("password", "aPw");
dbProp.put("loginTimeout", "35");
dbProp.put("binaryBatchInsert", "true");
dbProp.put("autocommit", false);
DataSource dataSource = setupDataSource("myConnectURI", dbProp);  //this the standard example
on the website

Connection conn = dataSource.getConnection();
System.out.println("autocommit: " + conn.getAutoCommit());   //this prints out false

Next.
I moved the above code verbatim to my actual server code.
The first connection I get from the pool has autocommit == false.  I return this connection
back to the pool.
But the second time I get a connection from the pool it has autocommit == true.

I have no idea why autocommit is set to a different state for the second connection?  I can
do a test and then set to autocommit = false, but I would like to understand the inconsistency.

Thanks.

Steve Pruitt

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


Mime
View raw message