What version of the mssql lib is it? What do the docs say about sleeping connections?
Alexander Tunick
@AlexanderTunick
"mysql": "^2.16.0", I haven't found any mention about sleeping in the docs of node-mssql
it just says that close() Close all active connections in the pool. And I would be grateful to know in which status it leaves connection ultimately
Daniel Hensby
@dhensby
Mysql? V2? That's not this lib, then
I think it's an operating system level issue and not to do with the lib.
It's nothing to worry about unless you start seeing hundreds of connections
Alexander Tunick
@AlexanderTunick
miscopied "mssql": "4.1.0",
Daniel Hensby
@dhensby
You'll want to upgrade. That's very old and there have been lots of improvements around pooling. But I also suspect this is just an internal quirk of SQL Server
Alexander Tunick
@AlexanderTunick
Yeah, I also suspect it. About upgrade I would, but I use knex query builder that doesn't work with the last version, though some time has flown, need to recheck the last co-workable version
Daniel Hensby
@dhensby
It does now, I've worked extensively on improving that.
Alexander Tunick
@AlexanderTunick
@dhensby wow, good news, thank you very much for informing me!
If you put a callback it will already start connecting
Either omit the callback and use the promise, or embrace callback hell
Daniel Hensby
@dhensby
@mn567 yes, they are wrong - issue #844 , fix #846 - fixed in v6 docs
dhaneshhs
@dhaneshhs
is there any sql query generator which works well with mssql which support easy way of generating INSERT query as i have more than 30 columns to be inserted to the table
I have a problem with the tutorial. I tried the ConnectionPool and always got the message that .on() is not a function and then I commented that out and tried it without, but now I get the error Already connecting to database. What did I do wrong? const mssql = require('mssql'); let config = {...}; // that one is correct, I tested it with a pure simple query const sqlPool = new mssql.ConnectionPool(config, err => { console.log(err); }).connect(); sqlPool.on('error', err => { log(err); }); const sqlQuery = queryString => { return sqlPool.then(pool => { pool.request().query(queryString) }).then(result => { console.dir(result); }) }; sqlQuery("SELECT * FROM users");
David Gasperoni
@mcdado
If you pass a callback to ConnectionPool, it will not return a promise
grrrr... no I get the error: TypeError: (intermediate value).then is not a function maybe I need a complete functioning module to adjust to my needs instead of small code samples. Do you have an example that I could use? I search for one that uses one connection for a long time (there maybe many calls to the same database from the same server without any other connections. So 1 connection that stays open for a longer time should be fine). The samples I found and that work all use a single call on a connection inside the connection call. But that way the connection would have to be closed and reopened on every query.
David Gasperoni
@mcdado
I think I know what you mean, personally I created a class that is technically a singleton for each database. Basically the connectionPool is module variable that calling modules access to. Then anytime I want to run requests I listen to the (already happened) on(“connect”) event
John McCallister
@mccallister_ftw_twitter
Hello
Usher Klein
@asherklein
Hi! I'm trying to connect to a SQL Server CE sdf file. Could someone please point me to an example?
I've tried a connection string like this: Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=Northwind.sdf;Persist Security Info=False;
And get the following error: ConnectionError: Failed to connect to Northwind.sdf:1433 - getaddrinfo ENOTFOUND Northwind.sdf
Any help would be greatly appreciated
thbl
@thbl
is there any benefits for using msnodesqlv8 vs using Tedious ?
Daniel Hensby
@dhensby
Msnkdesqlv8 is for people running on windows
kemmottar
@kemmottar
Hi im trying to listen the database's changes with node and mssql module but i fail so hard. Can u recommend a module for this
Jason Luboff
@JLuboff
@kemmottar What do you mean you're trying to listen to the changes?
kemmottar
@kemmottar
I want to see insert,update and delete
In the tables
Jason Luboff
@JLuboff
I would think you'd want to use a trigger or audit for that on the SQL server side. Unless those DML actions are taking place directly in your app in which case you could log it
kemmottar
@kemmottar
Yes i want to see dml actions in my app. How can i log it with node and listen database changos?
Ty for ur hielo
Help
Jason Luboff
@JLuboff
You would need to log them somewhere either before or after the statements are ran. As far as I know, you can't "listen" for DB changes with this module. Perhaps you could create a custom event listener though..
sql.on('myCustomListener, () => doSomething())
As @dhensby is one of the main maintainers, he may have a better idea
dhensby on master
Update changelog for v5 Merge pull request #796 from dh… (compare)