node-adodb
node-adodb copied to clipboard
No way to close or reset the connection
My electron application runs a simple query every 10 seconds to get the latest invoice of a POS' ADODB database. This works for a while but after 2-3 days the query stops working and it shows the following error:
The only way to resolve this issue is closing the app completely and opening it again, then it starts working again for 2-3 days until the same issue happens again. I tried "resetting" the connection with the following code:
async GetDBList(size: number) {
try {
this.COUNT_TRY++;
let data: any = await this.db.query("query to get the invoices");
this.COUNT_TRY = 0;
return data;
}
catch (ex) {
if (this.COUNT_TRY <= this.MAX_COUNT_TRY) {
this.db = ADODB.open(this.connectionString, this.x64);
await sleep(400);
return await this.GetDBList(size)
}
else {
log.error("GamaSoft:GetDBList:catch:", ex);
log.error(JSON.stringify(ex));
return undefined;
}
}
}
I thought by doing this i would be resetting the connection every time it fails, but the error keeps happening and the only way I have right now of really resetting the connection and making everything work correctly again is closing the app completely and opening it again.
@nuintun
It will automatically close the connection L72, but now I find it has some bugs. I will fixed in the next version!
@nuintun Great! Thanks
I've run into this same issue, any progress or anything I can do to help?