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

Already on GitHub? Sign in to your account

Server shutdown and reconnect options #3

nickiv opened this Issue Jan 10, 2012 · 2 comments


None yet
2 participants

nickiv commented Jan 10, 2012

Cretz, your work is really great! Api is awesome and pretty full.

I just found some issues related to network problems and server shutdown.

For instance, if SQL server is stopped between connect and statement.execute, exception is thrown:

throw new Error('Client must be in LOGGED IN state before executing sql'
Error: Client must be in LOGGED IN state before executing sql
at TdsClient.sqlBatch (/usr/local/lib/node_modules/tds/lib/tds-client.js:104:13)
at Statement. (/usr/local/lib/node_modules/tds/lib/tds.js:256:37)
at Statement.execute (/usr/local/lib/node_modules/tds/lib/tds.js:2:59)
at Object.doQuery as _onTimeout
at Timer.ontimeout (timers.js:84:39)

Can you give some advice on how to handle network outage and server restarts with your client?


cretz commented Jan 10, 2012

As one of the TODO's at the bottom of the page I listed an "end" event on the connection as a way to determine socket death, but I haven't implemented it even though it is very simple to do. Once I do that, I recommend using that method.

Overall, the client sits in several states. Once the socket connection is terminated, the client rolls back to it's initial state which means you can then connect and login all over again without recreating anything or tearing anything down yet. I just missed the important part: knowing when it's actually dead. I will solve this soon.

@ghost ghost assigned cretz Jan 11, 2012

@cretz cretz closed this in d949fbd Jan 12, 2012

@cretz cretz reopened this Mar 16, 2012


cretz commented Mar 16, 2012

Reopened pending release so it is clear this has not been published to NPM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment