X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 30FEC11F6B8B for ; Sun, 2 Apr 2006 22:03:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91610-03 for ; Sun, 2 Apr 2006 22:03:34 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by postgresql.org (Postfix) with ESMTP id 0B29011F6AFE for ; Sun, 2 Apr 2006 22:03:31 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.21]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1FQDTd-0006Cr-GO; Mon, 03 Apr 2006 13:03:29 +1200 Message-ID: <4430745E.2000001@opencloud.com> Date: Mon, 03 Apr 2006 01:03:26 +0000 From: Oliver Jowett User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Philip Yarra CC: Dave Cramer , Amaresh Wakkar , pgsql-jdbc@postgresql.org Subject: Re: 25P02, current transaction is aborted, commands ignored References: <200604021130.RAA11482@WS0005.indiatimes.com> <9B9703A9-2B17-4485-A035-D0DEF68C9932@fastcrypt.com> <44306FD9.1040905@utiba.com> In-Reply-To: <44306FD9.1040905@utiba.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.113 required=5 tests=[AWL=0.113] X-Spam-Score: 0.113 X-Spam-Level: X-Archive-Number: 200604/18 X-Sequence-Number: 14952 Philip Yarra wrote: > I always assumed what Dave just said, but porting from Oracle & Sybase > to PostgreSQL, we ran into exactly the same issue - we also solved it > with savepoints. However, I threw together the attached sample app to > test *precisely* what ends up in the database when auto-commit is off. > For the impatient, it sets auto-commit off, and tries to insert 3 rows. > The first succeeds, the second violates a unique index, so fails, and > the third is issued after the second, so should also fail. We ignore the > exceptions, then commit. The results puzzle me somewhat: > static void executeInsert(int id, String msg) > { > log("executeInsert, id[" + id + "] msg[" + msg + "]"); > PreparedStatement stmt = null; > try{ > stmt = conn.prepareStatement("INSERT INTO tempextest(id,msg) VALUES(?,?)"); > stmt.setInt(1,id); > stmt.setString(2,msg); > stmt.executeUpdate(); > conn.commit(); > } catch (SQLException sqlex) { > log(sqlex); > closeStatement(stmt); > } > } Um, your testcase is committing after every insert, not once at the end. So the behaviour you see sounds correct. -O