Introduction
Sometimes, you may only be able to connect to a Microsoft SQL (MS-SQL, or MSSQL) server through its SQL port, so you cannot use RDP to access the Enterprise Manager or other graphical tools on the host. Other times, you may simply want to leverage the power of a Linux box. 😉 Regardless of the reason, if you want to connect to a MS-SQL server from a Linux box, read on… As in previous posts, any installation or configuration instructions pertain to Gentoo. Please adapt as necessary. … Also, these instrcutions were tested on MS-SQL Server 2000, so some instructions may need to be adapted depending on your version of MS-SQL.
Basics
FreeTDS offers an opensource command line client, tsql. This is comparable to using Microsoft’s OSQL command line interface, although the arguments to launch the client are different. Although it has various options, you launch tsql, like so:
tsql -S <sql_server_name> -U <user_name> [-P <password>]
If you are comfortable with OSQL, you will have no problem using this basic SQL CLI client.
Programmatic
Packagers are available for Perl, PHP, Python, and several other scripting languages, which provide an extensive, programmatic interface to the remote MS-SQL server.