Support Questions

Find answers, ask questions, and share your expertise

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

avatar

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

avatar
Super Collaborator

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]

View solution in original post

3 REPLIES 3

avatar
Super Collaborator

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]

avatar

Thank you. This solved the problem.

avatar
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