Answer the question
In order to leave comments, you need to log in
Database problem?
Hello, I am working with mysql database in node js through mysql module.
There is a function to get data:
const getData = q=>{
return new Promise((resolve,reject)=>{
connection.query(q, (err,result)=>{
if(err) reject(err);
resolve(result);
});
});
};
connection.end()
, so after a while the application crashes, this is understandable. ( PROTOCOL_CONNECTION_LOST ) if(err) reject(err);
resolve(result);
connection.end();
connection.query(q, (err,result)=>{
if(err) throw err;
console.log(result);
connection.end();
});
Answer the question
In order to leave comments, you need to log in
That's on the 2nd update
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question