handshaking a SQL server with Javascript handshaking a SQL server with Javascript sql-server sql-server

handshaking a SQL server with Javascript


MS SQL doesn't have a text based protocol to allow you to interface with it through telnet. You can use a web socket to determine of the target server is listening on 1433, but you're best bet for completing the login sequence is to use a sql client api.


SQL Server connections use the TDS protocol, which is documented in the Tabular Data Stream Protocol Specification. If you follow the protocol specification, consult the protocol examples and have a peek at the FreeTDS open source implementation you should be able to do a low level handshake and more, using basic sockets. However, there really really isn't any point in doing so besides an academic exercise. But the nail in the coffin is the WebSockets, which are not basic sockets.

The way to go is to expose the SQL Server database to the web using a web service interface preferable REST, possibly OData) and then consume this web service from your Javascript HTML5 application. Here is a good read: Creating an OData API for StackOverflow including XML and JSON in 30 minutes.


In HTML5, JavaScript can communicate directly to SQL with SQLite. Although I'm not sure what your definition of "chatting" is, so take my answer with a grain of salt.
http://html5doctor.com/introducing-web-sql-databases/