我跟着this doc嘗試建立到配置單元的jdbc連接。但日食顯示這個錯誤。似乎沒有搞清楚它到底意味着,用適當的用戶名和密碼的連接,直線的作品所以它不是authentication.Below的問題是我要面對錯誤:JDBC到配置單元連接在無效操作失敗isValid()
> 15/11/27 13:15:41 INFO jdbc.Utils: Supplied authorities: localhost:10000
> 15/11/27 13:15:41 INFO jdbc.Utils: Resolved authority: localhost:10000
> 15/11/27 13:15:41 INFO jdbc.HiveConnection: Will try to open client transport with JDBC Uri: jdbc:hive2://localhost:10000/default
> Exception in thread "main" java.sql.SQLException: Method not supported
at org.apache.hive.jdbc.HiveConnection.isValid(HiveConnection.java:1026)
at HiveJDBC.main(HiveJDBC.java:21)
這裏是代碼:
import java.sql.SQLException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.DriverManager;
public class HiveJDBC {
private static String driverName = "org.apache.hive.jdbc.HiveDriver";
public static void main(String[] args) throws SQLException {
try {
Class.forName(driverName);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.exit(1);
}
Connection con = DriverManager.getConnection("jdbc:hive2://localhost:10000/default", "hive", "PASSWORD");
if(con.isValid(0)){
System.out.println("success");
}else{
System.out.println("fail");
}
Statement stmt = con.createStatement();
String tableName = "tabledriver";
//stmt.executeQuery("create database " + tableName);
}
}
兩者都是相同的。 「org.apache.hive.jdbc.HiveDriver」 – Codex
我已經從已安裝的配置單元庫引用了相同的hive-jdbc-1.2.1.jar,所以它也與直線一樣,如果我沒有錯的話。爲直線而不同?如何檢查直線使用的罐子.. – Codex