Linux down through ODBC Connection SQL server
1, demand:
recently, there is a need to Linux down connection (can be performed SQL statement) SQL server
2, Environment
Operating System: Centos6.5
database: SQLServer2014 Span lang= "en-us" >
Database has users Admin , the password is 123456 , the database library name is Chzh
3, note:
MSnever offered.SQL Server Forlinux,so don't try it onLinuxSystem InstallationSQL Server,but you can passODBCConnectionWindowsSystem ofSQL Serverdatabase;
4, Required packages:
Linux System of ODBC
Unixodbc-2.2.11.tar.gz ( http://www.unixodbc.org )
connecting sqlserver or Span lang= "en-US" >sybase driver
Freetds-stable.tgz ( http://www.freetds.org/ )
Package See Accessories
5, installation configuration
(user must be installed under root )
1, installationUnixODBC
# tar Vxzf unixodbc-2.2.11.tar.gz
# CD unixODBC-2.2.11
#./configure--prefix=/usr/local/unixodbc--enable-gui=no--enable-drivers=no--with-qt-dir=/usr/lib/qt-3.3
# make
# make Install
2, installationFreeTDS
# tar Vxzf freetds-stable.tgz
# CD freetds-0.64
#./configure--prefix=/usr/local/freetds--with-unixodbc=/usr/local/unixodbc--with-tdsver=8.0
# make
# make Install
3, ConfigurationFreeTDS
# Cd/usr/local/freetds
# VI Etc/freetds.conf
Modify to the following content:
[Global]
# Tdsprotocol Version
Tdsversion = 8.0
[SQLServer2014]
Host = 10.0.0.3
Port = 1433
Tdsversion = 8.0
Client charset= UTF-8
one of the[SQLServer2014]represents the server name used on the client (inTSQLto join in the command-S SQLServer2014),HostRepresentativeSQL ServerServer'sIPaddress,Portrepresents a port. Client CharSetis the character set used by the client,Client CharSetmust be greater than or equal to the character set used by the server database.
6, test connection:
#/usr/local/freetds/bin/tsql-s 10.0.0.3-u Admin
Locale is "ZH_CN. UTF-8 "
Locale CharSet is "UTF-8"
password:123456
1>
Here we can enter the SQL statement.
From for notes (Wiz)
List of attachments
Connect SQL Server via ODBC under Linux