CraZySacX / node-jdbc

JDBC Wrapper for node.js
140 stars 106 forks source link

Connection is made but there is no data returned ! #167

Closed Fahme closed 6 years ago

Fahme commented 6 years ago

Hello i'm trying to connect to hive server with Hortonworks configuration connection is made

Mar 06, 2018 3:32:39 PM org.apache.hive.jdbc.Utils parseURL
INFO: Supplied authorities: 127.0.0.1:10000
Mar 06, 2018 3:32:39 PM org.apache.hive.jdbc.Utils parseURL
INFO: Supplied authorities: 127.0.0.1:10000
Mar 06, 2018 3:32:39 PM org.apache.hive.jdbc.Utils parseURL
INFO: Resolved authority: 127.0.0.1:10000
Mar 06, 2018 3:32:39 PM org.apache.hive.jdbc.Utils parseURL
INFO: Supplied authorities: 127.0.0.1:10000
Mar 06, 2018 3:32:39 PM org.apache.hive.jdbc.Utils parseURL
INFO: Resolved authority: 127.0.0.1:10000
Mar 06, 2018 3:32:39 PM org.apache.hive.jdbc.Utils parseURL
INFO: Resolved authority: 127.0.0.1:10000
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Using connection: 30e1e40c-ec8a-4826-9b7a-fc62e80d1da2

but when i'm trying to query data or create table, database an undefined message is shown.

the code for connection.

var JDBC = require('jdbc');
var jinst = require('jdbc/lib/jinst');

if (!jinst.isJvmCreated()) {
  jinst.addOption("-Xrs");
  jinst.setupClasspath([
    '/usr/hdp/current/hive-client/jdbc/hive-jdbc-1.2.1000.2.6.3.0-235-standalone.jar',
    '/usr/hdp/current/hive-client/hive-exec.jar',
    '/usr/hdp/current/hive-client/hive-common.jar',
    '/usr/hdp/current/hive-client/hive-metastore.jar',
    '/usr/hdp/current/hive-client/hive-service.jar',
    '/usr/hdp/current/hive-client/httpclient-4.4.jar',
    '/usr/hdp/current/hive-client/httpcore-4.4.jar',
    '/usr/hdp/current/hive-client/libthrift-0.9.3.jar',
    '/usr/hdp/current/hive-client/libfb303-0.9.3.jar',
    '/usr/hdp/current/hadoop-client/hadoop-common.jar',
    '/usr/hdp/current/hadoop-client/hadoop-auth.jar',
    '/usr/hdp/current/hadoop-client/lib/log4j-1.2.17.jar',
    '/usr/hdp/current/hadoop-client/lib/slf4j-log4j12-1.7.10.jar',
    ]);
}

var config = {
  drivername: 'org.apache.hive.jdbc.HiveDriver',
  url: 'jdbc:hive2://127.0.0.1:10000/default',
  user : 'fahme',
  password: '',
  minpoolsize: 2,
  maxpoolsize: 3
};

var testpool = null;
var testconn = null;
var hsqldb = new JDBC(config);

hsqldb.initialize(function(err) {
  if (err) {
    console.log(err);
  }
});

hsqldb.reserve(function(err, connObj) {
     console.log("Using connection: " + connObj.uuid);
     var conn = connObj.conn;
     conn.createStatement(function(err, statement) {
        statement.executeQuery("show databases;",function(err,resultSet){
            console.log(resultSet);
        });
     });    
}); 
CraZySacX commented 6 years ago

I need to know what the message is. Also, I think you need the regular slf4j jar file on your classpath to enable your logging. Everything else looks correct.

Fahme commented 6 years ago

There is no any error messages actually when i'm trying to execute show databases; the response shown is undefined or when trying to create tables it's not creating the table inside the database. below is screenshot screen shot 2018-03-06 at 8 10 02 pm

i'm using openjdk version 1.8.0_161 if that helps !

Fahme commented 6 years ago

also when installing the module for the first time there is few warning pops up i'm not sure if that have any effect on the code because there is already connection being established. screen shot 2018-03-06 at 8 26 50 pm

Fahme commented 6 years ago

Thanks this issue was resolved.