From dev-return-1336-apmail-tephra-dev-archive=tephra.apache.org@tephra.incubator.apache.org Thu Jul 6 21:56:47 2017 Return-Path: X-Original-To: apmail-tephra-dev-archive@minotaur.apache.org Delivered-To: apmail-tephra-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6D9BD1ADDC for ; Thu, 6 Jul 2017 21:56:47 +0000 (UTC) Received: (qmail 39943 invoked by uid 500); 6 Jul 2017 21:56:47 -0000 Delivered-To: apmail-tephra-dev-archive@tephra.apache.org Received: (qmail 39901 invoked by uid 500); 6 Jul 2017 21:56:47 -0000 Mailing-List: contact dev-help@tephra.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tephra.incubator.apache.org Delivered-To: mailing list dev@tephra.incubator.apache.org Received: (qmail 39886 invoked by uid 99); 6 Jul 2017 21:56:47 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jul 2017 21:56:47 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 8E4DF1889E0 for ; Thu, 6 Jul 2017 21:56:46 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=salesforce.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id DL3DxnjP-TsA for ; Thu, 6 Jul 2017 21:56:44 +0000 (UTC) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id D56D45FACE for ; Thu, 6 Jul 2017 21:56:43 +0000 (UTC) Received: by mail-lf0-f51.google.com with SMTP id t72so12258936lff.1 for ; Thu, 06 Jul 2017 14:56:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salesforce.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8ik1da7S29oRAWeCVWPxmGKbgqp8WDuAsNpm6OFpy68=; b=fqmJBKHsao+ksf52fJ3DH4CDsOUI7H0wTl6PGfQpGFIn3RaLfAiP9Tw1NB9YDg14RL YbjD9xe8hrznVwIbtPKG14/xcD0W07oAXFV3XmCkqFak+SpviK64Ghpo2xKLOXeHBY81 3De+OZUAnbERG8DXJl7P0oXuRdObNuzUyIltg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8ik1da7S29oRAWeCVWPxmGKbgqp8WDuAsNpm6OFpy68=; b=Fckk0lBIEnCTsIXOcRKHiuhlAzD12LblftJGQOplAajoXhmjdFgtAZ34Wtq6+6Q1ia 5x9Jtj5DERxK07eSDrGhJilzcNMQQE8vEEAqzyMZWIXHRMFF/3cQJZ7JH5DDw8X6QTR2 vmPiNtBxZFea0q3/YMLIayWo9peTM8HWU78J0Bqpti0acPJ17P2B60T+w51HrbRNQjWO IRn0fvFhzWCEzSUD/83I4W0icnDGkEPcitgomdukUd+8pGYxZmUFhDs1pw532e6q0mH6 mzxQcgL3ogrhJE8Ia0Kx6qmLdXjhpWodhZuPsGH97Fx3Ktj/D6kBv2l1RgqxG9GK41kX WEaA== X-Gm-Message-State: AKS2vOxUVrBlTuxN8uRXB2qJh3SiDIAvSZJaAERy2qq4i5c9hGcG8DCD EoWzq+vOUfiSMdnIpxIfnsKXbv4nB+RJ X-Received: by 10.25.196.194 with SMTP id u185mr17352417lff.88.1499378203053; Thu, 06 Jul 2017 14:56:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.33.210 with HTTP; Thu, 6 Jul 2017 14:56:42 -0700 (PDT) In-Reply-To: References: <1fe612a7-3cee-4669-98e1-f06a0f594226@googlegroups.com> <8D2C8524-47BD-4343-A6D8-2E5E18EE93A7@cask.co> From: "Thomas D'Silva" Date: Thu, 6 Jul 2017 14:56:42 -0700 Message-ID: Subject: Re: How to use Auto-Commit and transactions in Phoenix ?? To: dev@tephra.incubator.apache.org Cc: Vishal Biradar Content-Type: multipart/alternative; boundary="001a114b206a2db0bb0553ad3100" --001a114b206a2db0bb0553ad3100 Content-Type: text/plain; charset="UTF-8" When you set autoCommit to true on a connection a commit is a called after each statement is executed. If you want to commit a batch of rows from the client set auto commit to false and call commit on the connection when you are ready. On Thu, Jul 6, 2017 at 1:10 PM, Poorna Chandra wrote: > BCC tephra-user@googlegroups.com > > > Moving the discussion to dev@tephra.incubator.apache.org so that someone > who has more context on how Phoenix auto commit works can chime in. > > Poorna. > > On Thu, Jul 6, 2017 at 1:04 PM, Gokul Gunasekaran wrote: > > > Vishal, > > > > I see that you have opened a TEPHRA JIRA regarding this issue ( > > https://issues.apache.org/jira/browse/TEPHRA-237). We can continue the > > conversation there. Also, as you might have noticed Tephra is now under > > incubation in ASF. So you can send your questions/comments to > > dev@tephra.incubator.apache.org. > > > > Thanks, > > Gokul > > > > On Jul 6, 2017, at 1:08 AM, Vishal Biradar > wrote: > > > > I am trying to use auto commit and transactions.But the problem I am > > facing is it is not rollbacking the data if any exception is raised. > > > > > > ------------------------------------------------------------ > > ------------------------------------------------------------ > > > > public class HbasePhoenixMainApp { > > > > public static void main(String[] args) throws SQLException { > > > > Connection connection = null; > > > > Statement st = null; > > > > Properties connectionProps = new Properties(); > > connectionProps.put("phoenix.connection.autoCommit", "true");//only > client > > connectionProps.put("phoenix.transactions.enabled", "true");//only > client > > connection = DriverManager.getConnection("jdbc:phoenix:localhost:2181",c > > onnectionProps); > > st = connection.createStatement(); > > st.executeUpdate("CREATE TABLE MYTEST.MYTAB (employee_id integer not null > > primary key, name varchar) TRANSACTIONAL=true"); > > st.executeUpdate("UPSERT INTO MYTEST.MYTAB VALUES (1,'Vishal')"); > > st.executeUpdate("UPSERT INTO MYTEST.MYTAB VALUES (2,'Biradar')"); > > > > int c = 10/0; //here exception will be raised > > > > st.executeUpdate("UPSERT INTO MYTEST.MYTAB VALUES (3,'India')"); > > > > }//main method closed > > > > } // class is closed > > --------------------------------------------------------------------- > > > > > > As I am using auto-commit thats why i am not doing any > connection.commit() > > explicitly. > > It must be committed automatically. > > So it must rollback all the above data insert operations but actually it > > is inserting above two data insert operations. > > But I need that it must rollback all the operations. > > Is this is the right approach ?? > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Tephra User" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to tephra-user+unsubscribe@googlegroups.com. > > To post to this group, send email to tephra-user@googlegroups.com. > > To view this discussion on the web visit https://groups.google.com/d/ > > msgid/tephra-user/1fe612a7-3cee-4669-98e1-f06a0f594226%40 > googlegroups.com > > 3cee-4669-98e1-f06a0f594226%40googlegroups.com?utm_medium= > email&utm_source=footer> > > . > > For more options, visit https://groups.google.com/d/optout. > > > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Tephra User" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to tephra-user+unsubscribe@googlegroups.com. > > To post to this group, send email to tephra-user@googlegroups.com. > > To view this discussion on the web visit https://groups.google.com/d/ > > msgid/tephra-user/8D2C8524-47BD-4343-A6D8-2E5E18EE93A7%40cask.co > > 47BD-4343-A6D8-2E5E18EE93A7%40cask.co?utm_medium=email&utm_source=footer> > > . > > > > For more options, visit https://groups.google.com/d/optout. > > > --001a114b206a2db0bb0553ad3100--