TSQL(1)

okay bestie, welcome to the tsql(1) manual page β€” yes, the FreeTDS diagnostic utility is here to vibe-check your TDS connections. 🧚✨

🌸 NAME 🌸

tsql β€” utility to test FreeTDS connections and queries. literally that. πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

tsql {-S servername [-I interface] | -H hostname [-L] [-p port]}
     [-D dbname] [-U username] [-P password] [-o options]
tsql -C

✨ DESCRIPTION ✨

okay so tsql is a FreeTDS diagnostic tool, and it’s giving protocol-testing main character energy. it uses the TDS protocol to connect to a Sybase or Microsoft SQL Server, and it lets the user issue queries. lowkey iconic. 🫢

the thing to know: tsql does not use the FreeTDS client libraries. instead, it uses only the lowest level library, libtds, to test the protocol implementation. that’s the whole point, bestie.

you can run tsql in two ways: one uses freetds.conf, and one 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. no cap. πŸ¦‹

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. slay. ✨

πŸ‘‘ OPTIONS πŸ‘‘

one bullet per flag, all facts intact, no skips:

  • -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.
  • -L β€” list Microsoft server instances (with -H).
  • -C β€” print some of the compile-time configuration parameters.
  • -o options β€” apply the options specified to every command.
    • -f β€” no footer [result count].
    • -h β€” no header [titles].
    • -t β€” print time.
    • -v β€” print version.
    • -q β€” quiet.
  • -a appname β€” application name.
  • -t colterm β€” column terminator.
  • -r rowterm β€” row terminator.
  • -r rowterm β€” row terminator. (the original really lists it twice, so we’re keeping the duplicate, bestie 🫢)
  • -J charset β€” character set.
  • -v β€” verbose mode.

πŸ’œ NOTES πŸ’œ

  • if you can connect with tsql -S servername, your basic FreeTDS installation is working. periodt. πŸ’–
  • typing exit, quit, or bye (or ^D) exits tsql. bye bestie πŸ‘‹
  • typing version displays the TDS protocol version.
  • command batches may be separated with go or GO. if you use GO, the version string is reported before executing the batch.
  • after prompting for the password (if not provided with -P), tsql will attempt to connect to the remote server. tsql displays a counter indicating the number of seconds elapsed during the connection attempt. typically, tsql immediately responds with a 1> prompt. if you see the counter (1, 2, 3, ...), most likely tsql is unable to connect to the indicated server. 😭
  • tsql is not a replacement for a complete isql such as sqsh (www.sqsh.org). if you have suggestions for ways to make tsql more useful as a diagnostic tool, please post them to the FreeTDS mailing list for consideration. πŸ’…

πŸŽ€ HISTORY πŸŽ€

tsql first appeared in FreeTDS 0.60. a whole era. ✨

🌈 AUTHORS 🌈

the tsql utility was written by Brian Bruns. king behavior πŸ‘‘

πŸ¦‹ BUGS πŸ¦‹

Several, to be sure, now that it’s documented. :) β€” yes, that’s the actual bug report energy. πŸ’€

that’s it, bestie β€” source/version: FreeTDS 1.5.20, date: March 25, 2015, manual footer tag: TSQL(FreeTDS). πŸ«ΆπŸ’…βœ¨

πŸ“¦ where this page comes from