Answers for "Error: Client has already been connected. You cannot reuse a client."

0

Error: Client has already been connected. You cannot reuse a client.

- var client = new pg.Client(connection);
-
 function test() {
+    var client = new pg.Client(connection);
+
     client.connect(err => {
         if (err) {
             console.log(err);
             return;
         }
         client.query('select 123', [], (err, data) => {
             if (err) {
                 console.log(err);
             } else {
                 console.log('DATA:', data.rows[0]);
             }
             client.end();
         });
     });
 }
Posted by: Guest on February-11-2021

Code answers related to "Error: Client has already been connected. You cannot reuse a client."

Code answers related to "Javascript"

Browse Popular Code Answers by Language