FreeBSD环境下设定odbc

ports安装 mysql
cd /usr/ports/databases/mysql51-server; make install clean
安裝unixODBC
                cd /usr/ports/databases/unixODBC; make install clean
安裝MySQL ODBC Driver
                cd /usr/ports/databases/mysql-connector-odbc; make install clean
安裝MS SQLServer ODBC Driver
                cd /usr/ports/databases/freetds-msdblib; make install clean
 
/usr/local/etc/odbcinst.ini 指定安裝的odbc library位置,例如
==================================================
[MySQL]
Description             = ODBC Driver for MySQL
Driver          = /usr/local/lib/libmyodbc3.so
Setup           = /usr/local/lib/libodbcmyS.so
FileUsage               = 1
CPTimeout               =
CPReuse         =
[FreeTDS]
Description             = ODBC Driver for MS SQL server /Sybase v0.63
Driver          = /usr/local/lib/libtdsodbc.so
Setup           = /usr/local/lib/libtdsS.so
UsageCount              = 2
=======================================
 
 /usr/local/etc/odbc.ini 整定DSN (Data Source Name),例如
================================================
[MySQL-test]
Description     = MySQL database test
Driver          = MySQL
Server          = localhost
Database        = databasename
Port            = 3306
Socket          =
Option          =
Stmt            =
[MS-SQLServer-test]
Description     = MS SQLServer(OR Sybase) database test
Driver          = FreeTDS
Server          = IP Address
Port            = PortNumber(1433)
Database        = databasename
Trace           = No
========================================================
 
测试程序:isql
***
NOTE:
亦可以由/usr/ports/databases/freetds编译**,但是注意TDS Version內定为5.0,版本适用范围请参阅下列网址
http://www.freetds.org/userguide/choosingtdsprotocol.htm
 测试以8.0连接SQL EXPRESS( SQL Server 2005),能順利连接但无法下SQL指令,改用7.0帽正常运作。
 **
make   TDS_VER=7.0 -DWITH_MSDBLIB install clean
 
源码安装:
 1.unixODBC-2.2.14.tar.gz
 tar xzvf unixODBC-2.2.14.tar.gz
cd  unixODBC-2.2.14
./configure --prefix=/code/unixODBC --enable-gui=no
make
make install
2.mysql-connector-odbc-3.51.26r1127.tar.gz
tar zxvf mysql-connector-odbc-3.51.26r1127.tar.gz
cd mysql-connector-odbc-3.51.26r1127
./configure --with-unixODBC=/code/unixODBC --with-mysql-path=/code/mysql --enable-gui=no
make
make install
3.freetds-0.64.tar.gz
tar vxzf freetds-0.64.tar.gz
cd freetds-0.64
./configure --prefix=/usr/local/freetds --with-unixodbc=/usr/local/unixODBC --with-tdsver=8.0
make
make install

......

你可能感兴趣的:(sql,mysql,server,Sybase,database,sqlserver,FreeBSD)