Skip to content

Instantly share code, notes, and snippets.

@theduderog
Last active December 18, 2015 23:19
Show Gist options
  • Save theduderog/d24bf6820d9a034f1763 to your computer and use it in GitHub Desktop.
Save theduderog/d24bf6820d9a034f1763 to your computer and use it in GitHub Desktop.
ODBC connection does not close
var odbc = require('odbc');
var db = new odbc.Database();
db.open("DSN=Test;UID=foo;PWD=XXX", function(err)
{
if (err) {
console.error("error: ", err.message);
db.close();
}
else {
console.log("Connected");
//Comment this part out and db.close() will invoke the callback
//Otherwise, it does not
db.describe({database: 'RETAIL', schema: 'RETAIL', table: 'PURCHASES'}, function (err, result) {
if (err) {
console.error(err);
}
else {
console.log(result);
console.log("Closing connection");
db.close(function () {
console.log("Closed");
});
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment