node-odbc icon indicating copy to clipboard operation
node-odbc copied to clipboard

[HELP] Connection disconnected when running query

Open parthpaghdal0 opened this issue 1 year ago • 3 comments

Hello, everyone!

I am running the query to retrieve data from odbc database. It works well for first some queries, but after a while, I got following error.

image

Here is the connection string;

DRIVER={iSeries Access ODBC Driver};SYSTEM=???;DATABASE=???;UID=???;PWD=???

Anybody who knows how to fix this, please help me.

Thanks.

parthpaghdal0 avatar May 21 '24 08:05 parthpaghdal0

It's saying that the remote (IBM i) side disconnected. Could be a socket timeout or network blip or something. You could try enabling TCP keepalive with cwbcopwr. May need to do some investigation from the IBM i side, though I don't have any pointers for that unfortunately.

kadler avatar May 21 '24 14:05 kadler

@kadler Thanks for your reply. Can I connect to odbc every time when I am running query?

I am running query on webhooks, means I can run query twice at the same time.

parthpaghdal0 avatar May 21 '24 17:05 parthpaghdal0

There's no method for connect/query/disconnect all in one, but you could do that yourself if you wanted. If you are using the Pool interface, you may want to switch away from that. ODBC also has its own connection pooling interface, below node-odbc and you may want to check if that is enabled and leading to these issues as well.

kadler avatar May 21 '24 18:05 kadler