赞
踩
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/unixODBC-2.2.14-14.el6.x86_64
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/unixODBC-devel-2.2.14-14.el6.x86_64
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/unixODBC-kde-2.2.14-14.el6.x86_64
rpm -ivh unixODBC-2.2.14-14.el6.x86_64
rpm -ivh unixODBC-devel-2.2.14-14.el6.x86_64
rpm -ivh unixODBC-kde-2.2.14-14.el6.x86_64
下载:freetds-stable.tgz
http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
tar -zxvf freetds-stable.tgz
cd freetds-0.91/
./configure --prefix=/usr/local/freetds --with-tdsver=7.1 --enable-msdblib --with-gnu-ld --enable-shared --enable-static
make
make install
vi /usr/local/freetds/etc/freetds.conf
[mssql]
host = 192.168.100.9
port = 1433
tds version = 7.0
测试数据源
/usr/local/freetds/bin/tsql -S mssql -U sa -P password -D database
提示如下,证明配置成功。
locale is "zh_CN.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Default database being set to bodycheck
1>
vi /etc/odbcinst.ini
[SQLSERVER]
Description=freetds driver
Driver=/usr/local/freetds/lib/libtdsodbc.so
vi /etc/odbc.ini
[sql]
Driver=MSSQLSERVER #驱动名
Description=MSSQL Server
Servername=mssql #数据源
Database=database
配置完成,访问数据库
isql -v sql user password
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。