我正在尝试使用以下驱动程序从Java程序连接到impala
com.cloudera.impala.jdbc4.Driver
但是我得到了一个sql异常,低于stack-trace
java.sql.SQLException: [Simba][ImpalaJDBCDriver](500310) Invalid operation: java.net.ConnectException: Connection refused: connect;
at com.cloudera.impala.hivecommon.api.HiveServer2ClientFactory.createTransport(HiveServer2ClientFactory.java:224)
at com.cloudera.impala.hivecommon.api.HiveServer2ClientFactory.createClient(HiveServer2ClientFactory.java:52)
at com.cloudera.impala.hivecommon.core.HiveJDBCConnection.connect(HiveJDBCConnection.java:597)
at com.cloudera.impala.jdbc.common.BaseConnectionFactory.doConnect(BaseConnectionFactory.java:219)
at com.cloudera.impala.jdbc.common.AbstractDriver.connect(AbstractDriver.java:216)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.gcs.virdict.InsertImpala.generateValue(InsertImpala.java:86)
Caused by: com.cloudera.impala.support.exceptions.GeneralException: [Simba][ImpalaJDBCDriver](500310) Invalid operation: java.net.ConnectException: Connection refused: connect;
我还附上以下代码供参考
private void connectionImpala() {
try {
Class.forName(IMPALA_DRIVER_NAME);
} catch (ClassNotFoundException e) {
e.printStackTrace();
System.exit(1);
}
Connection con = null;
Statement stmt = null;
try {
con = DriverManager.getConnection( "jdbc:impala://IP:21050/default;user=abcde;password=abcde");
stmt = con.createStatement();
// ResultSet rs = stmt.executeQuery(sqlStatement)
} catch (SQLException e) {
e.printStackTrace();
}