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 <[email protected]> wrote:

> BCC [email protected]
>
>
> Moving the discussion to [email protected] 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 <[email protected]> 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
> > [email protected].
> >
> > Thanks,
> > Gokul
> >
> > On Jul 6, 2017, at 1:08 AM, Vishal Biradar <[email protected]>
> 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 [email protected].
> > To post to this group, send email to [email protected].
> > To view this discussion on the web visit https://groups.google.com/d/
> > msgid/tephra-user/1fe612a7-3cee-4669-98e1-f06a0f594226%40
> googlegroups.com
> > <https://groups.google.com/d/msgid/tephra-user/1fe612a7-
> 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 [email protected].
> > To post to this group, send email to [email protected].
> > To view this discussion on the web visit https://groups.google.com/d/
> > msgid/tephra-user/8D2C8524-47BD-4343-A6D8-2E5E18EE93A7%40cask.co
> > <https://groups.google.com/d/msgid/tephra-user/8D2C8524-
> 47BD-4343-A6D8-2E5E18EE93A7%40cask.co?utm_medium=email&utm_source=footer>
> > .
> >
> > For more options, visit https://groups.google.com/d/optout.
> >
>

Reply via email to