Error: connection.release is not a function
vincebanzon opened this issue · 1 comments
vincebanzon commented
Expected Behavior
I can't get this to work.
I followed the README.md,
Current Behavior
I can't release the connection
//release the connection back to the pool when finished
connection.release();
Error Message
TypeError: connection.release is not a function
at Request [as userCallback] (D:\webservice\app.js:158:18)
at Request._this.callback (D:\webservice\node_modules\tedious\lib\request.js:60:27)
Environment
var Connection = require('tedious').Connection;
var ConnectionPool = require('tedious-connection-pool');
var Request = require('tedious').Request;
// follow the rest of README.md
// ...
// my additional code not in README.md which I believe is lacking.
var config = {
userName: creds.user, // update me
password: creds.password, // update me
server: creds.host, // update me
options: {
database: creds.options.database,
encrypt: true,
rowCollectionOnRequestCompletion : true
}
}
connection = new Connection(config);
connection.on('connect', function(err){
if(err){
console.log("Error connecting to database: ", err)
}
else {
console.log("Connection to Database Success.");
}
})
Steps to Reproduce (for bugs)
- I basically followed the README.md
- but connection is not instantiated nor has history on how it was created.
- As you can see, I have connection created, but I'm now confused of connectionPool and connection
- Due to that, I can't use connection.release.
connection.release is not a function
Possible Solution
Please add to README.md more information regarding connection and how it has been instantiated.
vincebanzon commented
I saw it now. It is in callback in
pool.acquire((err, connection) => {
}
Now, I need to add this to all of my request.