tsql (1) - Linux Manuals

tsql: utility to test FreeTDS connections and queries


tsql - utility to test FreeTDS connections and queries


Br o -S servername [-I interface ] | -H hostname [-L ] [-p port ] Br c [-D dbname ] [-U username ] [-P password ] [-o options ]


is a FreeTDS diagnostic tool. It uses the TDS protocol to connect to a Sybase or Microsoft SQL Server, and lets the user issue queries. does not use the FreeTDS client libraries. Instead, it uses only the lowest level library, libtds, to test the protocol implementation.

can be run in two ways, one which uses the freetds.conf and one which connects directly using the server's hostname and port. The -H and -p parameters are provided to let the user verify a server is listening on the named host and port. These parameters override any configuration files and environment variables. Pl The -S parameter can be used to test the local configuration. FreeTDS will use freetds.conf (or equivalent) and environment variables in the normal way to determine the server's IP address and port. You can use -I to specify a filename, overriding FreeTDS's configuration file search algorithm.


-S servername
database server to which to connect.
-D dbname
database to use.
-I interface
freetds.conf or interfaces file describing servername.
-H hostname
DNS hostname of the server.
-p port
port at which SQL Server is listening.
-U username
database login name. If username is not provided, a domain login is attempted for TDS 7+ connections.
-P password
database password.
list Microsoft server instances (with -H ).
print some of the compile-time configuration parameters.
-o options
apply the options specified to every command.

No footer Bq result count
No header Bq titles
Print time
Print version

-a appname
application name.
-t colterm
column terminator.
-r rowterm
row terminator.
-r rowterm
row terminator.
-J charset
character set.
verbose mode.


If you can connect with `tsql' -S servername Ns , your basic FreeTDS installation is working.

Typing `exit' Ns , `quit' Ns , or `bye' (or ^D ) exits

Typing `version' displays the TDS protocol version.

Command batches may be separated with `go' or `GO' Ns . If `GO' the version string is reported before executing the batch.

After prompting for the password (if not provided with -P ), will attempt to connect to the remote server. displays a counter indicating the number of seconds elapsed during the connection attempt. Typically, immediately responds with a `1>' prompt. If you see the counter (1, 2, 3, ...), most likely is unable to connect to the indicated server.

is not a replacement for a complete isql such as sqsh (www.sqsh.org). If you have suggestions for ways to make more useful as a diagnostic tool, please post them to the FreeTDS mailing list for consideration.


first appeared in FreeTDS 0.60.


The utility was written by An Brian Bruns Ns .


Several, to be sure, now that it's documented. :)