tephra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "vishal (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TEPHRA-237) Unable to discover tx service
Date Fri, 07 Jul 2017 04:44:02 GMT

    [ https://issues.apache.org/jira/browse/TEPHRA-237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16077569#comment-16077569
] 

vishal commented on TEPHRA-237:
-------------------------------


{code:java}
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",connectionProps);
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
}
{code}


I know with Auto-commit false it will rollback the operations as we need to write the conn.commit();
at the end of the program.So any exceptions occurred before the last line it will rollback.
But then what is use of transactions ??
How they are working ?? By taking above example can anyone tell me in details .. 

> Unable to discover tx service
> -----------------------------
>
>                 Key: TEPHRA-237
>                 URL: https://issues.apache.org/jira/browse/TEPHRA-237
>             Project: Tephra
>          Issue Type: Bug
>         Environment: Hbase Version : 1.2.6
> Phoenix Version : 4.10.0-Hbase-1.2 
>            Reporter: vishal
>            Assignee: Poorna Chandra
>
> My Java prog is:
> {code:java}
> Properties connectionProps = new Properties();
> connectionProps.put("phoenix.schema.isNamespaceMappingEnabled", "true");//client+server
> connectionProps.put("phoenix.schema.mapSystemTablesToNamespace","true");//client+server
> connectionProps.put("phoenix.connection.autoCommit", "true");//client
> connectionProps.put("phoenix.transactions.enabled", "true");//client+server
> Connection connection = DriverManager.getConnection("jdbc:phoenix:localhost:2181",connectionProps);
> Statement st = connection.createStatement();
> st.executeUpdate("CREATE TABLE MYTEST1.MYTAB (employee_id integer not null primary key,
name varchar) TRANSACTIONAL=true");
> System.out.println("table is created");
> {code}
> hbase-site.xml file
> ------------
> {code:java}
> <configuration>
> <property>
>     <name>hbase.rootdir</name>
>     <value>file:/Users/sai/projects/vishal/software/hbase-data</value>
> </property>
>  
> <property>
>     <name>hbase.zookeeper.property.dataDir</name>
>     <value>/Users/sai/projects/vishal/software/zookeeper-data</value>
> </property>
> <property>
>     <name>phoenix.schema.isNamespaceMappingEnabled</name>
>     <value>true</value>
> </property>
> <property>
>     <name>phoenix.schema.mapSystemTablesToNamespace</name>
>     <value>true</value>
> </property>
> <property>
>     <name>phoenix.transactions.enabled</name>
>     <value>true</value>
> </property>
> <property>
>     <name>data.tx.snapshot.dir</name>
>     <value>/Users/sai/projects/vishal/software/tephra/snapshots</value>
> </property>
> </configuration>
> {code}
> But I am getting above error??
> What else i need to do ??



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message