tephra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Poorna Chandra <poo...@cask.co>
Subject Re: How to use Auto-Commit and transactions in Phoenix ??
Date Thu, 06 Jul 2017 20:10:11 GMT
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 <gokul@cask.co> 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 <vishalb.engg@gmail.com> 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%40googlegroups.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 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
> <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.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message