本站即日起正式部署SSL证书启用https安全连接, 联系站长:416326801#qq.com(#改成@)

Linux系统连接MSSQL

标签: Linux MSSQL

安装unixODBC、freetds


cd ~
yum install unixODBC
wget http://mirrors.xmu.edu.cn/ubuntu/archive/pool/main/f/freetds/freetds_0.82.orig.tar.gz
tar -zxvf freetds_0.82.orig.tar.gz
cd freetds-0.82
./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix
make && make install

echo "/usr/local/freetds/lib" >> /etc/ld.so.conf
ldconfig

/usr/local/freetds/bin/tsql -H 10.206.3.9 -p 1433 -U admin -P 123456
连接成功后,显示
locale is "en_US.UTF-8"
locale charset is "UTF-8"
1>
点击查看原图



/php-5.4.41/ext/mssql/mssql
/usr/local/webserver/php/bin/phpize
./configure –with-php-config=/usr/local/webserver/php/bin/php-config –with-mssql=/usr/local/freetds 
make 
make install 

find / -name mssql.so
/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/mssql.so

vi /usr/local/php/etc/php.ini
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/mssql.so
配置freetds.conf



vi /usr/local/freetds/etc/freetds.conf
#Chinese
client charset = GBK

# A typical Microsoft server
[egServer]
        host = 10.206.3.9
        port = 1433
        tds version = 8.0