Windows叔我就不吱歪了,不会多丢人,下面说说Unix和Linux下怎么配置ODBC连接。
下载unixODBC, MySQL-connector-odbc
安装unixODBC:tar xzvf unixODBC-2.2.14.tar.gz
cd tar unixODBC-2.2.14
./configure --prefix=/code/unixODBC --enable-gui=no
make
make install
安装mysql-connector-odbc (libltdl required, )
tar xzvf mysql-connector-odbc-5.1.5r1144.tar.gz
cd mysql-connector-odbc-5.1.5r1144/
./configure --with-unixODBC=/code/unixODBC --with-mysql-path=/code/mysql --enable-gui=no
make
make install
odbc相关配置
cat /etc/odbcinst.ini
[mysql]
Description = MySQL driver.
Driver = /usr/local/lib/libmyodbc5-5.1.5.so
Setup = /code/unixODBC/lib/libodbcmyS.so
Socket = /tmp/mysql.sock
FileUsage = 1
cat /etc/odbc.ini
[mysql-test]
Description = MySQL test database
Trace = On
TraceFile = stderr
Driver = mysql
SERVER = localhost
USER = root
PASSWORD = mysql
PORT = 3306
DATABASE = test
socket = /tmp/mysql.sock
推荐你直接使用freetds来连接,这样比较简单,反正你只是需要访问数据库,并且odbc的程序也是要你自己写的。我当时用freetds来连接sybase数据库,感觉使用起来还是很简单的。欢迎分享,转载请注明来源:内存溢出
评论列表(0条)