node.jsclientvoltdb

voltdb-client-nodeJS doesn't work about @AdHoc proceduer


I followed the voltdb-client-nodeJS, and implement the @AdHoc query function, but the "read" function didn't callbacked, so that can't get any queried results, can't determine if the connection is successful, too.

[callProcedure code]

var query = resultsProc.getQuery();
query.setParameters(["select * from Q_SHIPPINGCARRIERHISTORY_STREAMING where TrackingNumber=431476575751"]);
client.call(query, function read(errorCode, eventCode, results){
 ...
}, function write(errorCode, eventCode, results){
 ...
});

[connect DB code]

 var config = new VoltConfiguration();
 config.host = "s7biapp26";
 config.port = 8080;
 var client = new VoltClient([config]);
 client.connect(function(code, event, results){
    ...
 });

On the second attempt, can't require('voltjs') or require('volt') after npm install voltjs(version:voltjs@0.2.0).

So, could you provide a more detailed documentation about the voltdb-client-nodeJS, or paste a simpler demo of @AdHoc, thank you very much!


Solution

  • The key is connected voltdb failed by error code in connect callback function, I tried to remove the port, then connected success!

    The secondly, requiring the module should require('voltjs/lib/client').

    referenced the links:

    https://github.com/VoltDB/voltdb-client-nodejs/issues/12

    https://forum.voltdb.com/forum/voltdb-discussions/building-voltdb-applications/577-nodejs-client-for-helloworld