JDBC warning on setAutoCommit(false) - Mailing list pgsql-jdbc

From Dustin Sallings
Subject JDBC warning on setAutoCommit(false)
Date
Msg-id Pine.OSX.4.50.0212222359410.586-100000@dhcp-196.west.spy.net
Whole thread Raw
Responses Re: JDBC warning on setAutoCommit(false)  (Barry Lind <blind@xythos.com>)
List pgsql-jdbc
    I've got some code that abstracts JDBC connections and does all
kinds of magic for me.  One of things it does is, when returning a
connection to the pool, it looks for any SQLWarnings the connection
contains.  I've got a few things that begin transactions by setting
autocommit to false, then do some work, then commit (or rollback), and
then set autocommit back to true.  When the connection is returned to the
DB, the following warning is issued:

java.sql.SQLWarning: WARNING:  COMMIT: no transaction in progress
    at org.postgresql.jdbc1.AbstractJdbc1Connection.addWarning(AbstractJdbc1Connection.java:430)
    at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:111)
    at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:482)
    at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:461)
    at org.postgresql.jdbc1.AbstractJdbc1Connection.setAutoCommit(AbstractJdbc1Connection.java:942)
    [...my code...]

    This doesn't seem like the right thing to do...I should be able to
enable autocommit without a warning when a transaction is not in progress.
If anything, I should get a warning is there *is* a transaction in
progress.

--
SPY                      My girlfriend asked me which one I like better.
pub  1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin@spy.net>
|    Key fingerprint =  87 02 57 08 02 D0 DA D6  C8 0F 3E 65 51 98 D8 BE
L_______________________ I hope the answer won't upset her. ____________

pgsql-jdbc by date:

Previous
From: "Thomas Roemer"
Date:
Subject: JDBC Error
Next
From: Daniel Serodio
Date:
Subject: Re: JDBC Error