meteor-mssql
meteor-mssql copied to clipboard
Sql connections
Is it possible to initialize a sql connection in code instead of from settings? I would like to loop through a collection of connection settings and query each db for monitoring purposes.
/Jesper
Cool package - got it running in 10 minutes.
Got it :+1:
Sql.connection = new Sql.driver.Connection(dbdata, Meteor.bindEnvironment(function (err) { if (err) {console.log("Can't connect to database");} else {
query = "select top 5 * from sometable order by id desc";
// Sync-style
try {
var res = Sql.q(query);
return res;
} catch (e) {
debugger
console.log(e);
}
}
}));
And dbdata contains:
{
"server" : "123.123.123.123",
"database" : "dbname",
"user" : "username",
"password" : "somepass",
"options" : {
"useUTC" : false,
"appName" : "MSSSQL App"
}
I was wrong .. it reuses the first connection made. Is it possible at all?
Ya we need a way to connect to multiple databases, the way it is now is pretty restrictive.
Is there a solution to connect to multiple databases, now?