Answer the question
In order to leave comments, you need to log in
JugglingDb how to catch connect?
I want to connect to mySQL database.
const Schema = require('jugglingdb').Schema;
const schema = new Schema('mysql', {
host: host,
username: user,
password: password,
tableName : tableName,
database: ddbname,
port: port
});
connection.connect err { Error: connect ECONNREFUSED 127.0.0.11:3306
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1117:14)
--------------------
at Protocol._enqueue (E:\Web\apc-nodejs\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Protocol.handshake (E:\Web\apc-nodejs\node_modules\mysql\lib\protocol\Protocol.js:51:23)
at Connection.connect (E:\Web\apc-nodejs\node_modules\mysql\lib\Connection.js:118:18)
at initializeConnection (E:\Web\apc-nodejs\node_modules\jugglingdb-mysql\lib\mysql.js:53:20)
at Object.initializeSchema [as initialize] (E:\Web\apc-nodejs\node_modules\jugglingdb-mysql\lib\mysql.js:34:5)
at new Schema (E:\Web\apc-nodejs\node_modules\jugglingdb\lib\schema.js:106:13)
at router.post (E:\Web\apc-nodejs\routes\addApp.js:25:22)
at Layer.handle [as handle_request] (E:\Web\apc-nodejs\node_modules\router\lib\layer.js:93:5)
at next (E:\Web\apc-nodejs\node_modules\router\lib\route.js:138:13)
at Route.dispatch (E:\Web\apc-nodejs\node_modules\router\lib\route.js:109:3)
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.11',
port: 3306,
fatal: true }
will reconnect in 60 secs
connection.connectis an (object?) of mySQL itself and the question is: how to catch this exception in case of incorrectly entered data and execute disconnect()?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question