Re: JDBC warning on setAutoCommit(false)

From: Barry Lind <blind(at)xythos(dot)com>
To: Dustin Sallings <dustin+postgres(at)spy(dot)net>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC warning on setAutoCommit(false)
Date: 2002-12-23 17:42:21
Message-ID: 3E074AFD.10707@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Dustin,

Please provide more info, like what versions you are using (both server
and driver) as well as a test case that reproduces the problem.

--Barry

Dustin Sallings wrote:
> 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. ____________
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mike Bridge 2002-12-23 18:21:19 Using 7.1 driver with 7.3?
Previous Message Remigius Stalder 2002-12-23 16:50:12 Re: Stored procedures/functions that can return recordsets...