Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connection config #46

Closed
sapkal-manish opened this issue Aug 21, 2012 · 9 comments
Closed

connection config #46

sapkal-manish opened this issue Aug 21, 2012 · 9 comments

Comments

@sapkal-manish
Copy link

hi all,
i am using tedious for my backend database (MSSQL 2008) with node.js.
while configuring tedious if i am setting 'local' instead of IP address in server tag, it is not working. when i am change (local)/local to IP address, it is going very fine.

following is the my config setting for tedious.

var config = {
// server: 'local',
server: 'XXX.XXX.X.XXX',
userName: 'UserName',
password: 'UserPassword',
options: {
database: 'databaseName'
}
};

so, i don't understand what is the problem?

@pekim
Copy link
Collaborator

pekim commented Aug 21, 2012

'local' (probably) won't resolve to an IP address. You probably want 'localhost'.

@sapkal-manish
Copy link
Author

if i am set 'localhost', it is giving me error 'Login failed; one or more errorMessage events should have been emitted'
from 'connect' event.

and what is better idea? means if i am setting IP address instead of 'localhost' keyword in tedios config, how it is helpful to increase performance.

@pekim
Copy link
Collaborator

pekim commented Aug 21, 2012

What messages were in any emitted errorMessage or infoMessage events? They will give a clue what the server is objecting to.

Performance is not going to be affected by how the IP address is resolved (other whether a DNS lookup is involved).

@sapkal-manish
Copy link
Author

it is occurred in 'errorMessage' event. i am using tediousPooler.


SQLConnect.js

var tediousPooler = require('./TediousPooler');
var config = {
server: 'localhost',
//server: 'XXX.XXX.X.XXX',
userName: 'UserName',
password: 'UserPassword',
options: { database: 'databaseName' }
};

if ((pooler === null) || (pooler === undefined)) {
console.log('\r\n creating new pooler : ' + pooler + '\r\n');
pooler = new tediousPooler(config);

}

TediousPooler.js

var poolModule = require('generic-pool')
, Connection = require('tedious').Connection;

exports = module.exports = TediousPooler;

function TediousPooler(config) {
// console.log("\r\n Manish 1 : " + err + "\r\n");
this.pool = poolModule.Pool({
name: 'tedious',
create: function (callback) {
// console.log("\r\n Manish 3 : " + err + "\r\n");
var connection = new Connection(config);
// console.log("\r\n Manish 4 : " + err + "\r\n");
connection.on('connect', function (err) {
if (err) {
//here i am getting error
console.log(err); }
else { callback(null, connection); }
});
},
destroy: function (client) { connection.close(); },
max: 10,
idleTimeoutMillis: 30000
});
};

TediousPooler.prototype.callProcedure = function (request) {
this.pool.acquire(function (err, connection) {
connection.callProcedure(request);
});
};

@pekim
Copy link
Collaborator

pekim commented Aug 22, 2012

"it is occurred in 'errorMessage' event. i am using tediousPooler."

What message is present in the errorMessage event?

@sapkal-manish
Copy link
Author

error 'Login failed; one or more errorMessage events should have been emitted'
from 'connect' event.

@pekim
Copy link
Collaborator

pekim commented Aug 22, 2012

That is the error from the connect event. What I meant is, what errors are reported in errorMessage (or infoMessage) events?

@sapkal-manish
Copy link
Author

Issue #46
no error catch in 'InfoError' or 'ErrorMessage' event !!!

@pekim
Copy link
Collaborator

pekim commented Oct 29, 2012

Connection pooling is now a separate project, tedious-connection-pool. If the same problem occurs with that pool implementation please open an issue there.

@pekim pekim closed this as completed Oct 29, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants