Example: Run application for the Phoenix thin client

Checking the example of how to run a maven application for the Phoenix thin client gives you better understanding about how to run your own application for the Phoenix thin client.

The requiredKerberos options set to false for the Phoenix thin client which means that it can be used from virtually any node. In this example, the client runs from the local machine.

For the Phoenix thin client the describe-client-connectivity call returns a base JDBC URL . You must append the following attributes to the URL which are specific to your identity:
  • avatica_user: your CDP username (required)
  • avatica_password: your CDP worload password (required)
  • truststore: a truststore for your CDP Knox gateway (optional)
  • truststore_password: the password for the truststore file (optional)

You can use Maven to ease launching this application, but a standalone Java program is similarly launched:

$ mvn exec:exec -Dexec.executable=java -Dexec.args='-cp target/sql-libs/*:target/sql-exemplar-0.0.1-SNAPSHOT.jar com.cloudera.odx.sql.ThinClient "jdbc:phoenix:thin:url=<base_phoenix_thin_jdbc_URL>;serialization=PROTOBUF;authentication=BASIC;avatica_user=<username>;avatica_password=<password>;truststore=<cdp-truststore.jks>;truststore_password=<trustore_password>"'
Or, you can launch the application without the help of Maven:
$ java -cp target/sql-libs/*:target/sql-exemplar-0.0.1-SNAPSHOT.jar com.cloudera.odx.sql.ThinClient "jdbc:ph