linux ubuntu 16.04
no i am not using docker
Sir Thank you for this solution but still error is same
Error: SQLITE_ERROR: no such table: NCS"
I think the error speaks by itself.
- Can you confirm the database path
- the database table
- whether there are any data in the database table in question with column
Person_ID
Can you open the database using the command line client and show the tables. Screenshot that showing the command you used to open the database please.
Sir I have checked the path can you tell how to check the path where Sqlite database is stored in linux.
How did you open the database in your very first post and showed that you have 2 tables ?
sqlite> .tables
NCS NCS_DATABASE
- show the command you used to open the db
- which is the correct table NCS or NCS_DATABASE ?
i think .. the db path is correct .. try changing, in function node, your sql query instead NCS .. replace with NCS_DATABASE. maybe you are using the wrong table.
... but confirm the above information !
There may be more than one db on the system.
yes i have changed that SQL query with NCS_DATABASE.
but actually whenever I am injecting it is showing output ,but If i dont want to do inject manually,I mean by FOB mqtt code i am already passing that FOB ID then what i have to write in SQL to get the output.
it is showing me this while debugging
8/26/2020, 8:12:05 PMnode: Debug23
SELECT Person_ID FROM NCS_DATABASE WHERE Person_ID=' 0 4 2 2 2 4 3 6 ' : msg.payload : undefined
undefined
So now you get a result ? its fixed ? no "no such table" error ?
yeaahhh no such error is coming.Thanks for that solution.
But further i got stucked .help please.
what is coming from your FOB MQTT .. paste the complete message and use
.. im guessing, a 'person id' is being passed with MQTT and you want to search the db based on that id ?
we need to know the complete structure of the FOB MQTT message
yes sir correct .
[
{
"id": "4ee90eec.77d9f",
"type": "mqtt in",
"z": "a0a22bbe.4dd42",
"name": "",
"topic": "FOB",
"qos": "2",
"datatype": "auto",
"broker": "3d22a2f.7bec8de",
"x": 130,
"y": 140,
"wires": [
[
"d9dae4cd.dd58b8",
"2862d90b.82b8b6"
]
]
},
{
"id": "3d22a2f.7bec8de",
"type": "mqtt-broker",
"z": "",
"name": "",
"broker": "tcp://mqtt.eclipse.org",
"port": "1883",
"clientid": "NCS_Client03",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
}
]
.. we needed the mqtt message not the flow
This is your MQTT msg :
{"topic":"FOB","payload":" 0 4 2 2 2 4 3 6 ","qos":2,"retain":false,"_msgid":"23a61276.129afe"}
so the mqtt payload has spaces in ? maybe it will need some processing because the db table may not have spaces between the numbers. Can you confirm ?
@Colin will this work? .. msg.payload.replace(" ", "");
yes mqtt has spaces
and the database it has spaces on not ?