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.
jdbc:phoenix:[comma-separated ZooKeeper Quorum [:port [:hbase root znode [:kerberos_principal [:the path to kerberos keytab] ] ] ]
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
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
- ODBC driver
- Python driver for Phoenix
Obtaining a driver for application development
Based on your application development requirements, you can obtain one of the following drivers:
Use the /opt/cloudera/parcels/CDH/lib/phoenix/phoenix-18.104.22.168.2.0.0-128-client.jar file in the Phoenix server-client repository.
Use the Database Open Database Connectivity (ODBC) interface to access the operational database. The ODBC driver is provided by Cloudera as an additional download, but you can also use ODBC drivers from third-party providers.
Python driver for Phoenix
Download the Python Driver for Apache Phoenix from the Apache Phoenix website. For more information, see http://phoenix.apache.org/python.html.
Other drivers that are not supported by Cloudera
Other non-JDBC Drivers for Phoenix are available as add-ons and on other websites, but they are not supported by Cloudera. You can find compatible client drivers by searching on the web for avatica and the name of an application programming language that you want to use. For example, avatica python. For more information and links to driver download pages, see https://calcite.apache.org/avatica/docs/.
Microsoft .NET driver can be used with Phoenix but it is not supported by Cloudera. You can download and install a NuGet package for Microsoft .NET Driver for Apache Phoenix from the nuget website. For more information, see https://www.nuget.org/packages/Microsoft.Phoenix.Client/.