Riaan's SysAdmin Blog

My tips, howtos, gotchas, snippets and stuff. Use at your own risk!

LinuxMSSQL

Linux MSSQL Client

Quick note on connecting to a MSSQL database from Linux using tsql from FreeTDS. FreeTDS is a set of libraries for Unix and Linux that allows your programs to natively talk to Microsoft SQL Server and Sybase databases.

$ tsql -S DEVSQL1 -U <user> -P <password>
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1> select @@version
2> go

Microsoft SQL Server 2016 (RTM-CU1) (KB3164674) - 13.0.2149.0 (X64) 
	Jul 11 2016 22:05:22 
	Copyright (c) Microsoft Corporation
	Developer Edition (64-bit) on Windows Server 2012 R2 Standard 6.3 <X64> (Build 9600: ) (Hypervisor)

(1 row affected)

1> use DEVDB1
2> go
1> SELECT * FROM INFORMATION_SCHEMA.TABLES 
2> go
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	TABLE_TYPE
DEVDB1	        TABLE_1  	JPS_DN	        BASE TABLE

Ref: https://tryolabs.com/blog/2012/06/25/connecting-sql-server-database-python-under-ubuntu/

admin

Bio Info for Riaan