node.js - How to connect Node js with cassandra DSE graph using Gremlin? connection not working -
i try connect node js cassandra db in dsc use of gremlin. how connect cassandra db? using in 1.node js, 2.express js, 3. cassandra db, 4.data stack studio (dse), 5.gramlin queries(nosql). tried 2 ways can't able connect.how can connect cassandra db, dse , using gramlin query?thank you.
//1.i tried 1 first var dse = require('dse-driver'); var dse_driver = new dse.client({ contactpoints: ['127.0.0.1'], protocoloptions: { port: 9042 }, graphoptions: { name: 'demo_work_graph' } }); //2.i use 1 var cassandra = require('cassandra-driver'); var async = require('async'); var client = new cassandra.client({ contactpoints: ['127.0.0.1'], graphoptions: {name: 'demo_work_graph'} });
i getting error
error { error: line 1:0 no viable alternative @ input 'g' ([g]...) @ responseerror.drivererror (/home/periyasamy/k12os/server/node_modules/dse-driver/lib/errors.js:20:19) @ new responseerror (/home/periyasamy/k12os/server/node_modules/dse-driver/lib/errors.js:57:24) @ framereader.readerror (/home/periyasamy/k12os/server/node_modules/dse-driver/lib/readers.js:338:13) @ parser.parsebody (/home/periyasamy/k12os/server/node_modules/dse-driver/lib/streams.js:200:66) @ parser._transform (/home/periyasamy/k12os/server/node_modules/dse-driver/lib/streams.js:143:10) @ parser.transform._read (_stream_transform.js:186:10) @ parser.transform._write (_stream_transform.js:174:12) @ dowrite (_stream_writable.js:385:12) @ writeorbuffer (_stream_writable.js:371:5) @ parser.writable.write (_stream_writable.js:288:11) name: 'responseerror', stack: 'error: line 1:0 no viable alternative @ input \'g\' ([g]...)\n @ responseerror.drivererror (/home/periyasamy/k12os/server/node_modules/dse-driver/lib/errors.js:20:19)\n @ new responseerror (/home/periyasamy/k12os/server/node_modules/dse-driver/lib/errors.js:57:24)\n @ framereader.readerror (/home/periyasamy/k12os/server/node_modules/dse-driver/lib/readers.js:338:13)\n @ parser.parsebody (/home/periyasamy/k12os/server/node_modules/dse-driver/lib/streams.js:200:66)\n @ parser._transform (/home/periyasamy/k12os/server/node_modules/dse-driver/lib/streams.js:143:10)\n @ parser.transform._read (_stream_transform.js:186:10)\n @ parser.transform._write (_stream_transform.js:174:12)\n @ dowrite (_stream_writable.js:385:12)\n @ writeorbuffer (_stream_writable.js:371:5)\n @ parser.writable.write (_stream_writable.js:288:11)', message: 'line 1:0 no viable alternative @ input \'g\' ([g]...)', info: 'represents error message server', code: 8192, coordinator: '127.0.0.1:9042', query: 'g.v()' }
you should use dse-driver:
const client = new dse.client({ contactpoints: ['host1'], graphoptions: { name: 'demo_work_graph' } }); client.executegraph('g.v().count()') .then(console.log) .catch(console.error);
Comments
Post a Comment