Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aWLqD-0001w9-7A for pgsql-jdbc@arkaria.postgresql.org; Thu, 18 Feb 2016 10:29:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aWLqC-0002dd-Lw for pgsql-jdbc@arkaria.postgresql.org; Thu, 18 Feb 2016 10:29:44 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aWLqC-0002dR-2W for pgsql-jdbc@postgresql.org; Thu, 18 Feb 2016 10:29:44 +0000 Received: from hogranch.com ([75.101.82.47]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1aWLq9-0002NT-QZ for pgsql-jdbc@postgresql.org; Thu, 18 Feb 2016 10:29:42 +0000 Received: from [192.168.0.2] (porker [192.168.0.2]) by hogranch.com (8.11.6/8.11.6) with ESMTP id u1IATZ721164 for ; Thu, 18 Feb 2016 02:29:36 -0800 Subject: Re: JDBC behaviour To: pgsql-jdbc@postgresql.org References: From: John R Pierce Message-ID: <56C59D11.2070208@hogranch.com> Date: Thu, 18 Feb 2016 02:29:37 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-HawgScanner-Information: Please contact the ISP for more information X-HawgScanner: Found to be clean X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org if you want each insert to work indepedently yet stay with the transaction model, then each insert should be its own transaction... conn.setAutoCommit(false); executeUpdate("insert into employee(id,name) values(1, 'K1')"); conn.commit(); executeUpdate("insert into employee(id,name) values(1, 'K1')"); conn.commit(); executeUpdate("insert into employee(id,name) values(1, 'K2')"); conn.commit(); otherwise the way you wrote it, its a single transaction. all three inserts have to succeed, otherwise, all three are rolledback. why is that so hard to understand? -- john r pierce, recycling bits in santa cruz -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc