Using SQL and APIs with Apache Phoenix

You can create and interact with Apache HBase tables in the form of typical DDL/DML statements through its standard JDBC API. Apache Phoenix JDBC driver can be easily embedded in any app that supports JDBC.

Apache Phoenix has two kinds of JDBC drivers, thick and thin. The thick driver communicates directly with Apache ZooKeeper and Apache HBase and the thin client communicates with Apache HBase through Phoenix Query Server.

To connect to Apache Phoenix using the "thick" JDBC driver, you must use the JDBC URL syntax as shown here:
jdbc:phoenix:[comma-separated ZooKeeper Quorum [:port [:hbase root znode [:kerberos_principal [:the path to kerberos keytab] ] ] ]
Example URL
jdbc:phoenix:zookeeper1.domain,zookeeper2.domain,
zookeeper3.domain:2181:/hbase:phoenix@EXAMPLE.COM:/etc/security/keytabs/phoenix.keytab

If you are running your client on the Apache Phoenix cluster, you do not have to specify the ZooKeeper parameter; the ZooKeeper quorum is retrieved automatically from hbase-site.xml configuration file.

You can use the standard JDBC APIs instead of the regular HBase client APIs to create tables, insert data, and query your HBase data.

The following drivers are currently supported

  • JDBC driver
  • Microsoft .Net driver
  • Other non-Java drivers (example, Python driver)

Obtaining a driver for application development

Based on your application development requirements, you can obtain one of the following drivers:

JDBC driver

Use the /opt/cloudera/parcels/CDH/lib/phoenix/phoenix-5.0.0.7.2.0.0-128-client.jar file in the Phoenix server-client repository.

Microsoft .NET Driver

Download and install a NuGet package for Microsoft .NET Driver for Apache Phoenix. for more information, see https://www.nuget.org/packages/Microsoft.Phoenix.Client/.

Other non-Java drivers

Other non-JDBC Drivers for Phoenix are available as add-ons and on other websites, but they are not currently supported by Cloudera. You can find compatible client drivers by constructing a web search string consisting of "avatica" and the name of an application programming language that you want to use. Example: avatica python.

For more information about obtaining drivers for your application development, see http://phoenix.apache.org/faq.html.