presto的安装参考http://blog.csdn.net/ouyang111222/article/details/50507471
一 引入jar
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-jdbc</artifactId>
<version>0.100</version>
</dependency>
二 Java测试
public static void main(String[] args) throws SQLException, ClassNotFoundException {
Class.forName("com.facebook.presto.jdbc.PrestoDriver");
Connection connection = DriverManager.getConnection("jdbc:presto://10.199.xxx.xx:8001/kafka01/default","root",null); ;
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("show tables");
while (rs.next()) {
System.out.println(rs.getString(1));
}
rs.close();
connection.close();
}
出现如下的错误:
分析:类似错误均属于Java版本问题,即JDK版本过低,只要选择相对应的JDK版本编译即可。
48,49,50,51,52是Java编译器内部的版本号:
Unsupported major.minor version 52.0 对应于 JDK1.8(JRE1.8)
Unsupported major.minor version 51.0 对应于 JDK1.7(JRE1.7)
Unsupported major.minor version 50.0 对应于 JDK1.6(JRE1.6)
Unsupported major.minor version 49.0 对应于 JDK1.5(JRE1.5)
Unsupported major.minor version 48.0 对应于 JDK1.4(JRE1.4)