node.jscassandraloopbackcassandra-driver

automigration create database name 'undefined', create tables within 'undefined' database in loopback-connector-cassandra


I am trying to auto create table from the model using loopback 3 framework with cassandra database and experiencing some problem to connecting datasource with cassandra datasource.json

"cassandraConn": {
"host": "192.168.4.21",
"port": 9042,
"database": "emsv2_testing",
"password": "",
"name": "cassandraConn",
"user": "",
"connectTimeout": 30000,
"readTimeout": 30000,
"connector": "cassandra"
}

model json file:-

{
"name": "data_rt_raw_t1",
"plural": "data_rt_raw_t1s",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"c_id": {
"type": "string",
"required": true,
"default": null
},
"slave_id": {
"type": "string",
"required": false,
"default": null
},
"dcu_id": {
"type": "string",
"required": false,
"default": null
},
"mfm_read_time": {
"type": "date",
"required": true,
"default": null
},
"data_store_time": {
"type": "date",
"required": false,
"default": null
},
"p1": {
"type": "number",
"required": false,
"default": null
},
"p2": {
"type": "number",
"required": false,
"default": null
},
"p3": {
"type": "number",
"required": false,
"default": null
},
"p4": {
"type": "number",
"required": false,
"default": null
},
"p5": {
"type": "number",
"required": false,
"default": null
}

},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}

auto-migration create database name 'undefined', create tables within 'undefined' database. try to post the data getting following error,

{
"error": {
"statusCode": 500,
"name": "NoHostAvailableError",
"message": "Connecting after shutdown is not supported",
"info": "Represents an error when a query cannot be performed because no host is available or could be reached by the driver.",
"innerErrors": null,
"stack": "NoHostAvailableError: Connecting after shutdown is not supported\n at Client._connectCb (/home/rd/enms/node_modules/cassandra-driver/lib/client.js:397:21)\n at Client.promiseWrapper (/home/rd/enms/node_modules/cassandra-driver/lib/utils.js:410:13)\n at Client.connect (/home/rd/enms/node_modules/cassandra-driver/lib/client.js:384:31)\n at Array.utils.series.next (/home/rd/enms/node_modules/cassandra-driver/lib/client.js:854:18)\n at next

help me to sort out this problem, thanks.


Solution

  • The error you posted suggests that your application is attempting to run queries after you've closed the session or disconnected from the cluster.

    If you share some of the relevant sections of your application code, contributors here would be able to assist you better. Cheers!