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

No way to close or reset the connection

Open cargonzalv opened this issue 5 years ago • 4 comments

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:

image

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.

cargonzalv avatar Feb 05 '20 21:02 cargonzalv

@nuintun

cargonzalv avatar Feb 19 '20 17:02 cargonzalv

It will automatically close the connection L72, but now I find it has some bugs. I will fixed in the next version!

nuintun avatar Feb 23 '20 08:02 nuintun

@nuintun Great! Thanks

cargonzalv avatar Feb 24 '20 18:02 cargonzalv

I've run into this same issue, any progress or anything I can do to help?

HyperSprite avatar Nov 16 '20 19:11 HyperSprite