Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

HBase/Phoenix - How to specify autocommit in JDBC URL ?

Solved Go to solution

HBase/Phoenix - How to specify autocommit in JDBC URL ?

I want to avoid setting auto-commit=true by default, thus I am not adding the required property in hbase-site.xml.

However, I want to add auto commit property to the jdbc url so that I can get a connection with autocommit=true on need basis.

I am not able to find how to add this property to connection url.

I have a kerberized cluster and I an using the following url:

jdbc:phoenix[:zk_quorum][:zk_port][:zk_hbase_path][:headless_keytab_file:principal]

I also tried the following approach but it did not connect due to malformed url:

jdbc:phoenix[:zk_quorum][:zk_port][:zk_hbase_path][:headless_keytab_file:principal][:AutoCommit=true]
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: HBase/Phoenix - How to specify autocommit in JDBC URL ?

Expert Contributor

Replace the colon with a semi-colon in jdbc url and this will work:jdbc:phoenix[:zk_quorum][:zk_port][:zk_hbase_path][:headless_keytab_file:principal] [;autocommit=true]

3 REPLIES 3
Highlighted

Re: HBase/Phoenix - How to specify autocommit in JDBC URL ?

Expert Contributor

Replace the colon with a semi-colon in jdbc url and this will work:jdbc:phoenix[:zk_quorum][:zk_port][:zk_hbase_path][:headless_keytab_file:principal] [;autocommit=true]

Re: HBase/Phoenix - How to specify autocommit in JDBC URL ?

Thank you. This solved the problem.

Re: HBase/Phoenix - How to specify autocommit in JDBC URL ?

Super Guru
@Dinesh Chitlangia

you can use PhoenixRuntime.AUTO_COMMIT_ATTRIB as supported in following class.

https://github.com/apache/phoenix/blob/master/phoenix-core/src/main/java/org/apache/phoenix/util/Pho...

Please see the following JIRA to make sure you are using the version of Phoenix that supports it.

https://issues.apache.org/jira/browse/PHOENIX-1559

Don't have an account?
Coming from Hortonworks? Activate your account here