Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 9B9439FB7D0 for ; Tue, 20 Feb 2007 07:00:47 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 42504-09 for ; Tue, 20 Feb 2007 07:00:28 -0400 (AST) X-Greylist: delayed 00:06:40.337691 by SQLgrey-1.7.4 Received: from web39109.mail.mud.yahoo.com (web39109.mail.mud.yahoo.com [209.191.87.228]) by postgresql.org (Postfix) with SMTP id 466389FB7C0 for ; Tue, 20 Feb 2007 07:00:28 -0400 (AST) Received: (qmail 72123 invoked by uid 60001); 20 Feb 2007 10:53:46 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=WcuRSZQ67Z4/uBjlxwx3e+jzYUYImIzcF7lqt6Clip1anquBIAptKVpleoc8W5vgS4N3LqXP42YxYNMzMIbktY21TrXzURvp2CoHecfJvkYf7hvwSD/7XfuwZzngbkBatbJWgYcfJYd0UkpxPz3TjaYjMpGWEbsqGO1Mv7kF5iY=; X-YMail-OSG: t4kgw.MVM1meeKdn7MghaXkIumiKMKnDTMUE6Se1BcroUCOmYR27i079GXJRxYX0FXxeBcn4KmxPbfK.wIozPxE5lq9c4P0C_Dm7QgbMauHJ5Npn_E95lb31nHctiPKc2SgsU4bIzZigkQ0- Received: from [203.215.160.146] by web39109.mail.mud.yahoo.com via HTTP; Tue, 20 Feb 2007 02:53:46 PST Date: Tue, 20 Feb 2007 02:53:46 -0800 (PST) From: Altaf Malik Subject: Re: how to continue using a connection after an error with autocommit=false To: James Im , pgsql-jdbc@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1641247442-1171968826=:70270" Content-Transfer-Encoding: 8bit Message-ID: <305445.70270.qm@web39109.mail.mud.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=BAYES_50, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200702/105 X-Sequence-Number: 16661 --0-1641247442-1171968826=:70270 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit You can either commit or rollback the transaction when you encounter an SQL error. This will alow the next statements to execute successfully. --Altaf Malik EnterpriseDB www.enterprisedb.com James Im wrote: Hi, I just find out that I cannot continue using a connection when I use autocommit=false and that an sql insert failed. In pseudo code this is what I'd like to do: 1) create connection 2) set autocommit = false 3) do an insert that succeed 4) do an insert that fails 5) catch the SQLException (I don't do a rollback on purpose) 6) do a select with the same connection 7) do another insert 8) commit Everything goes well until step (6). where I receive the following error: ERROR: current transaction is aborted, commands ignored until end of transaction block Exception: org.postgresql.util.PSQLException org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1525) org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1309) org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188) org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354) org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:258) Can I do something is step (5) so that I don't get the error in step (6) ? I need to continue using the same connection. Thanks you your help. _________________________________________________________________ Vælg selv hvordan du vil kommunikere - skrift, tale, video eller billeder med MSN Messenger: http://messenger.msn.dk/ - her kan du det hele ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match --------------------------------- Don't get soaked. Take a quick peak at the forecast with theYahoo! Search weather shortcut. --0-1641247442-1171968826=:70270 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
You can either commit or rollback the transaction when you encounter an SQL error. This will alow the next statements to execute successfully.
 
--Altaf Malik
EnterpriseDB
www.enterprisedb.com

James Im <im-james@hotmail.com> wrote:
Hi,

I just find out that I cannot continue using a connection when I use
autocommit=false and that an sql insert failed.

In pseudo code this is what I'd like to do:

1) create connection
2) set autocommit = false
3) do an insert that succeed
4) do an insert that fails
5) catch the SQLException (I don't do a rollback on purpose)
6) do a select with the same connection
7) do another insert
8) commit


Everything goes well until step (6). where I receive the following error:

ERROR: current transaction is aborted, commands ignored until end of
transaction block
Exception: org.postgresql.util.PSQLException
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1525)
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1309)
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354)
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:258)


Can I do something is step (5) so that I don't get the error in step (6) ?
I need to continue using the same connection.

Thanks you your help.

_________________________________________________________________
Vælg selv hvordan du vil kommunikere - skrift, tale, video eller billeder
med MSN Messenger: http://messenger.msn.dk/ - her kan du det hele


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match


Don't get soaked. Take a quick peak at the forecast
with theYahoo! Search weather shortcut. --0-1641247442-1171968826=:70270--