Example to run application using 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 Apache 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=[***PHOENIX THIN JDBC URL;serialization=PROTOBUF;authentication=BASIC;avatica_user=[***USERNAME***];avatica_password=[***PASSWORD***];truststore=[***CDP-TRUSTSTORE.JKS***];truststore_password=[***TRUSTSTORE 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:phoenix:thin:url=[***PHOENIX THIN JDBC URL;serialization=PROTOBUF;authentication=BASIC;avatica_user=[***USERNAME***];avatica_password=[***PASSWORD***];truststore=[***CDP-TRUSTSTORE.JKS***];truststore_password=[***TRUSTSTORE PASSWORD***]"