In this tutorial I will show you how to do a basic connection to remote unsecure HBase Pheonix Query Server using Java. Phoenix allows you to run SQL commands over top HBASE. You can find the commands listed here.
POM.xml:
<dependency> <groupId>org.apache.phoenix</groupId> <artifactId>phoenix-server-client</artifactId> <version>4.7.0-HBase-1.1</version> </dependency>
Imports:
import java.sql.DriverManager; import java.sql.SQLException;
Connect:
Class.forName("org.apache.phoenix.queryserver.client.Driver"); Connection conn = DriverManager.getConnection("jdbc:phoenix:thin:url=http://localhost:8765;serialization=PROTOBUF");