1)     安装unixodbc管理器
tar xzvf unixODBC-2.3.0.tar.gz
cd unixODBC-2.3.0
sudo ./configure /usr/local/unixODBC
sudo make
sudo make install
2)     安装驱动
DB2:
mkdir /usr/local/db2
tar -zxvf /tmp/v9.5fp5_linuxx64_odbc_cli.tar.gz -C /usr/local/db2
cd /usr/local/db2/odbc_cli/clidriver/cfg
编辑db2cli.ini data source
[DB2_206]
Database=business
Protocol=TCPIP
Port=59505
Hostname=*.*.*.*
UID=db2inst1
PWD=*********

安装libstdc++.so.5包
cd /tmp
sudo tar -zvxf libstdc++5.tar.gz
sudo cp libstdc++5/usr/lib/x86_64-linux-gnu/libstdc++.so.5.0.7 /usr/lib/
建libstdc++5链接
cd /usr/lib
sudo ln -s libstdc++.so.5.0.7 libstdc++.so.5

SQLSERVER:
tar xzvf freetds-stable.tgz
cd  freetds-0.91
sudo ./configure --prefix=/usr/local/freetds --with-unixodbc=/usr/local/unixODBC --with-tdsver=8.0
sudo make
sudo make install
测试freetds连接
sudo vim /usr/local/freetds/etc/freetds.conf
[sql2008]
host = *.*.*.*
port = 1433
tds version = 8.0
client chaeset = UTF-8
cd  /usr/local/freetds/bin/
./tsql -S sql2008 -U sa -P ******
3)     修改ODBC配置文件
odbc.ini连接源文件
Db2
[DB2_206]
Driver=ODBC-DB2
Description=DB2 ODBC driver
Server=*.*.*.*
Port=59505
Database=business
Logging=No
LogFile=
SQLSERVER
[sqlserver]
Driver=freetds
Description=My Sample ODBC Database Connection
Server=*.*.*.*
Port=1433
Database=B2B
Socket =
Option =
Stmt =
TDS_Version = 8.0
Trace = No
odbcinst.ini驱动源
DB2:
[ODBC-DB2]
Description=ODBC-DB2 Driver
Driver=/usr/local/db2/odbc_cli/clidriver/lib/libdb2.so
Setup=
DontDLClose=1
FileUsage=1
UsageCount=1
SQLSERVER:
[freetds]
Description=MS-SQLServer
Driver=/usr/local/freetds/lib/libtdsodbc.so