我想通过 JDBC 连接 Presto DB。
String sql="Select * from mysql.infsci2711toturial.Person";
String url="jdbc:presto://localhost:8080/catalog";//Under catalog folder, there is my mysql.properties file.
Connection connection=null;
try{
connection=DriverManager.getConnection(url, "root", null);
Statement stmt=connection.createStatement();
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()){
System.out.println(rs.getString(1));
}
}catch(SQLException ex){
System.out.println(Arrays.toString(((URLClassLoader) ClassLoader.getSystemClassLoader()).getURLs()));
ex.printStackTrace();
System.out.println("wrong connection!");
}
eclipse 中显示的问题是: 没有为 jdbc:presto://localhost:8080/catalog 找到合适的驱动程序 我试图将 presto-jdbc-0.93.jar 放在 WEB-INF/lib 下。但是不要解决这个问题。如何解决这个问题呢。我需要设置 Maven 吗?如何?