In the past I have used FreeTDS on Linux, or pyodbc from Python scripts. A driver released this year from Microsoft has more complete support for SQL Server 2012, and a simpler installation procedure.
This is a binary distribution for RHEL / CentOS.
Install Linux driver for SQL Server: http://www.microsoft.com/en-us/download/details.aspx?id=28160
# uninstall unixODBC if version < 2.3.0 present sudo yum remove unixODBC # install unixODBC 2.3.0, ODBC driver, sqlcmd and bcp utilities ./build_dm.sh ./install.sh verify ./install.sh install # test connectivity sqlcmd -S <servername> -d <dbname> -U <user_id> -P <password>-Q "select @@version" # test
sqlcmd can be used interactively, or results piped to a file or process
bcp can be used for bulk import / export