IBM DB2 - insert json value to the query

Hi folks,

I’m trying the node IBM DB2 in my n8n test installation, to execute a query to my AS400 server. So I’ve added the module, and this module seems to work fine. I can query a static SQL and get the result, with no issue

Describe the problem/error/question

But the problem is that I would like to execute a query that uses JSON data as input.

What is the error message (if any)?

seems that my JS code written like this : {{ json.xxxxxx }} is interpreted by the query as text, and it is not using the value of the result of the JS code.

See below the workflow :

As seen in the screenshot, it returns the json.xxx text, instead of the result of the json.xxxx value : it should result 2 lines with ‘ADAVD’.

So I’m wondering if I 'm doing something wrong ?
Thanks for your help.
Regards,
Nicolas

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

{
“meta”: {
“instanceId”: “48cc4ee71a57de6eac2d5c69eec6fce44ab0d241e37f3c9d230ff706c86ee9c9”
},
“nodes”: [
{
“parameters”: {
“query”: “select ‘{{ $json.subject }}’ from QGPL/USERLIST \nLIMIT 2\n”
},
“id”: “967ab7c9-9e0f-4859-8297-de7f9c9fe8fb”,
“name”: “IBMi DB2”,
“type”: “n8n-nodes-ibmi-db2.ibmiDb2”,
“typeVersion”: 1,
“position”: [
900,
80
],
“alwaysOutputData”: true,
“credentials”: {
“ibmiDb2JdbcApi”: {
“id”: “plNF6LCdstWoG8QX”,
“name”: “IBM I Db2 account 2”
}
}
}
],
“connections”: {},
“pinData”: {}
}

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1:20
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: linux

Hey @NicolasB,

We don’t have a DB2 node so I suspect you are using a community node, It would be worth raising this as an issue with the node creator as I suspect there is an issue with the output they are returning.

Ok thanks for your reply.
I’ve posted in the community node repo.
Hope the developper is still active, otherwise I will need to find another way to connect to my IBM DB2 database :slight_smile:

1 Like

Hey, sorry, I’ve only just seen the issue. It’s a bug. I’m working on it and will publish an update soon

1 Like

It should be fixed now. I just published v1.0.3.

Please let me know if you have any other issues, and thanks for reporting this.

1 Like

Thanks @tmorello

I’ve checked this version 1.0.3 .But it seems the result is the same :

I’ve tried to run a simple query, the preview/result in the middle of the screen is understanding my $json.subject correctly. But the output of the node is still giving the {{ $json.subject }} instead tof the “user” value.
So if I tried to use this Subject value to the Where statement of my query it doesn’t work.
Thanks for your help.

1 Like

That finally works, I had to restart my n8n docker to clear cache. Big thanks to @tmorello !

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.