Home:ALL Converter>No suitable driver found for jdbc:presto

No suitable driver found for jdbc:presto

Ask Time:2015-03-15T01:37:37         Author:Hao Wu

Json Formatter

I want to connect Presto DB by JDBC.

 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!");
 }

The problem show in eclipse is that: No suitable driver found for jdbc:presto://localhost:8080/catalog I have tried to put presto-jdbc-0.93.jar under WEB-INF/lib. But don't solve this problem. How to solve this problem. Do I need set Maven? and how?

Author:Hao Wu,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/29052065/no-suitable-driver-found-for-jdbcpresto
Hao Wu :

Add \"Class.forName(\"com.facebook.presto.jdbc.PrestoDriver\");\"\nAnd presto require JDK 1.8. So update JRE to 1.8.",
2015-03-14T21:07:52
yy