简体   繁体   中英

Telnet connection with SQL Server

What is the simplest way to create a client application(in c++/c#) to communicate with the SQL Server? Since Iam a new-bie and very eager to know how this Database server is managing its connections, requests and responses. I have tried TELNET with the following command assuming that, I can open the connection and write to it.

TELNET <server>  <port>

But the command ends up with a black screen only. Please provide your comments as well as any helpful links.

Playing with HTTP connections was fun, since there was web-browser inspectors(like firebug) to help me:), but here I think things are much difficult & different, (Or if such a tool exists to log TCP connections?)

TDS, the protocol used by SQL Server, is not similar to HTTP or SMTP in that the commands are not sent via text, making it not terribly amenable to usage over TELNET. There's not any easy equivalent to:

GET / HTTP/1.1

There's some documentation on TDS here (from Microsoft) , here (from JTDS, a JDBC driver for Sybase and SQL Server) , and here (from FreeTDS) if you want to dig into it. If you want to observe the raw packet data, just use some sort client as Jirka Hanika recommended and use Wireshark or another packet-capture tool to observe the data.

Ultimately, if you want to learn something about network protocols, then maybe this worth playing with, but if you want to learn about SQL Server and relational database internals, there are much better places to start than with the network transfer layer, which are incidental to the actual function of databases.

For C#, look here . For C++, look here .

Make sure that you are freeing the database connection after use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM