Using FreeTDS connection under Linux sqlserver2008

Source: Internet
Author: User
Tags locale mssql

I mainly refer to the official articles

Some points to be aware of

1, compile FreeTDS (need to download), please add--prefix= installation directory--with-tdsver=7.1//This must be over 7.0 from official documents

./configure--prefix=/opt/freetds--with-tdsver=7.1

2, in addition to PHP connection time also need to add pdo_dblib (besides this there are 2 other ways)

3, compile pdo_dblib must specify the FreeTDS installation directory, otherwise you will not be connected to the parameters as follows

./configure--with-php-config=/usr/local/php/bin/php-config--with-pdo-dblib=/opt/freetds


4. After installation, test with TSQL to view the FreeTDS version for command

[[email protected] pdo_dblib]# tsql -ccompile-time settings  (established  with the  "Configure"  script)                              version:  freetds v0.91              Freetds.conf directory: /opt/freetds/etc     ms db-lib source  compatibility: no        Sybase binary  compatibility: no                       Thread safety: yes                       iconv  library: yes                         TDS version: 7.1                                iodbc: no                            unixodbc: no               SSPI  "Trusted"  logins: no                             kerberos: no

5. The test command is as follows:

[Email protected] pdo_dblib]# tsql-h 10.1.1.200-p 1433-u sapassword:locale is "en_US. UTF-8 "Locale charset is" UTF-8 "using default CharSet" UTF-8 "

6. Tips for adding ln-s shortcuts so you can use the TSQL command.

Ln-s/opt/freetds/bin/tsql/usr/bin/tsql

7. PDO Connection MSSQL mode

$DBH = new PDO ("dblib:host= $hostdb;d bname= $dbname", $USR, $PSW);


PDO connect MSSQL 3 ways as follows (only available under Linux under Windows Please see my previous post on SQL Server)

http://php.net/manual/zh/ref.pdo-dblib.connection.php

Using FreeTDS connection under Linux sqlserver2008

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.