Vivek Mohan
Vivek Mohan

Reputation: 8366

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?)

Upvotes: 0

Views: 4795

Answers (2)

ig0774
ig0774

Reputation: 41287

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.

Upvotes: 2

Jirka Hanika
Jirka Hanika

Reputation: 13549

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

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

Upvotes: 0

Related Questions