JDBC warning on setAutoCommit(false)

From: Dustin Sallings <dustin+postgres(at)spy(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: JDBC warning on setAutoCommit(false)
Date: 2002-12-23 08:04:36
Message-ID: Pine.OSX.4.50.0212222359410.586-100000@dhcp-196.west.spy.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)spy(dot)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. ____________

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Daniel Serodio 2002-12-23 11:24:02 Re: JDBC Error
Previous Message Kris Jurka 2002-12-23 07:26:10 Re: What is "objsubid"?