我正在尝试连接到hive db表单节点js,我尝试使用https://www.npmjs.com/package/jdbc。我也试过使用这个驱动程序
drivername:org.apache.hive.jdbc.HiveDriver
我收到以下错误:
错误:运行静态方法java.sql.SQLException时出错:不合适 找到jdbc的驱动程序:hive2:// hdprd1-edge-lb01:20000 在java.sql.DriverManager.getConnection(DriverManager.java:689)
这是我的代码段
var JDBC = require('jdbc');
var jinst = require('jdbc/lib/jinst');
if (!jinst.isJvmCreated()) {
// Add all java options required by your project here. You get one chance to
// setup the options before the first java call.
jinst.addOption("-Xrs");
// Add all jar files required by your project here. You get one chance to
// setup the classpath before the first java call.
jinst.setupClasspath(['./drivers/derby.jar',
'./drivers/derbyclient.jar',
'./drivers/derbytools.jar',
'./lib/drivers/hive-jdbc-1.2.1.jar',
'./lib/drivers/hive-exec-1.2.1.jar',
'./lib/drivers/hive-common-1.2.1.jar',
'./lib/drivers/hive-metastore-1.2.1.jar',
'./lib/drivers/hive-service-1.2.1.jar',
'./lib/drivers/httpclient-4.3.jar',
'./lib/drivers/httpcore-4.3.jar',
'./lib/drivers/libthrift-0.9.1.jar',
'./lib/drivers/libfb303-0.9.0.jar',
'./lib/drivers/hadoop-common-2.7.1.jar',
'./lib/drivers/slf4j-api-1.7.21.jar',
'./lib/drivers/org-apache-commons-logging.jar',
'./lib/drivers/hive-exec*.jar',
'./lib/drivers/antlr-runtime-3.0.1.jar',
'./lib/drivers/derby.jar',
'./lib/drivers/jdo2-api-2.1.jar',
'./lib/drivers/jpox-core-1.2.2.jar',
'./lib/drivers/jpox-rdbms-1.2.2.jar'
]);
}
var jdbcconfig = {
url: 'jdbc:hive2://hdprd1-edge-lb01:20000',
user : 'user',
password: 'password'
};
var testpool = null;
var testconn = null;
var hsqldb = new JDBC(jdbcconfig);
hsqldb.initialize(function(err) {
if (err) {
console.log(err);
}
});