I have tested my source code and it was able to successfully perform 'update if exists, otherwise insert' to my table, but I am not able to close my connection, as for my insert/update query reside in the search query. I put connection. Just create a connection on server startup and use the connection/client object to query all the time. Database connection error: Error: Cannot enqueue Query after invoking quit. and Note: If you’re serving web requests, then you shouldn’t be ending connections on every request. I understand that connection.query(.) is asynchronous, and I put my connection.end() in the very end of the function. According to: TL DR You need to establish a new connection by calling the createConnection method after every disconnection. The reason I include it in node is that the definition of 'duplicates' is customized. Cannot enqueue Query after invoking quit before end has been called. sqlInsert and sqlUpdate are defined elsewhere and has sql query defined with connection.query(.) similar to the function above. from my source code which has a block that does 'update if exists, otherwise insert' (similar logic as in another question I asked). Nevertheless, the code below doesn't work, because the connection.end () method is called before the SQL queries can run. and Closing the connection is done using end () which makes sure all remaining queries are executed before sending a quit packet to the mysql server. Error: Cannot enqueue Quit after invoking quit. Related Query Npm mysql + AWS Lambda: Cannot enqueue Query after invoking quit Node js + Mysql : cannot enqueue because of fatal errors Nodejs mysql pool. Every method you invoke on a connection is queued and executed in sequence. The best way to tune the connection pool parameters for production is using FlexyPool 1 by Vlad Mihalcea. NodeJSError: Cannot enqueue Handshake after invoking quit. To use Deploy with Oracle, ensure that the JDBC driver for Oracle JAR file is located in XLDEPLOYSERVERHOME/lib or on the Java classpath. I tried out commenting the connection.end() after following many Post on the same error but still this error persist.I am using mysql node module and having an error of Error: Cannot enqueue Query after invoking quit. Node.jsmysqlError: Cannot enqueue Query after invoking quit. I am trying to run this NodeJs code for adding data in Mysql DB: app.post("/taxi",(req,res)=> But when I wanted to use the functionality of updating data through transactions I got the following error: Error: Cannot enqueue Query after invoking quit.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |