<dependency>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-core</artifactId>
<version>4.7.0-HBase-1.1</version>
</dependency>
import java.sql.*;
public class Phoenix {
private static String driver = "org.apache.phoenix.jdbc.PhoenixDriver";
public static void main(String[] args) throws SQLException {
try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Statement stmt = null;
ResultSet rs = null;
long startTime = System.currentTimeMillis();
Connection con = DriverManager.getConnection("jdbc:phoenix:master01:2181");
stmt = con.createStatement();
String sql = "select * from S_INDEX limit 100000";
rs = stmt.executeQuery(sql);
/* while (rs.next()) {
System.out.println("id="+ rs.getString("id")+"|name="+rs.getString("name")+"|age="+rs.getString("age")+"sex="+rs.getString("sex"));
}*/
long endTime = System.currentTimeMillis();
long time = endTime - startTime;
System.out.println("10万查询时间:" + time+"毫秒");
stmt.close();
con.close();
}
}