Connect SQL Server via ODBC under Linux

Source: Internet
Author: User
Tags locale odbc

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

    Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.