谁有centos下odbc的配置
答案:1 悬赏:50 手机版
解决时间 2021-03-30 21:10
- 提问者网友:流星是天使的眼泪
- 2021-03-30 12:56
谁有centos下odbc的配置
最佳答案
- 五星知识达人网友:怙棘
- 2021-03-30 13:38
etting up ODBC on CentOS 5.2
Pre-requisites
unixODBC needs libstc++.so.5 and libtdl.so.3, which can be easily installed using
$ yum install compat-libstdc++-33.i386 libtool-ltdl.i386 libX11 libXcursor libXext
Next, we need to install unixODBC:
$ yum install unixODBC
Then we need the ODBC Driver and Setup Library (both generic RPM version), which can be downloaded on the MySQL website.
There's a newer version 5.1 of the ODBC connector on the site, but it will not work on CentOS 5.2!
Once they are downloaded in a directory, install both using
$ rpm -Uhv *.rpm
Ok, that's the installation part. Now let's go to the configuration.
Configuration files
/etc/odbcinst.ini
[MySQL ODBC 3.51 Driver]
DRIVER = /usr/lib/libmyodbc3.so
SETUP = /usr/lib/libmyodbc3S.so
UsageCount = 1
Delete everything else, especially if there are other driver sections referring to MySQL. They will not work anyway.
/etc/odbc.ini
This file defines your DSNs. Let's take this example:
[mydsn]
Description = emma database on devel2
Driver = /usr/lib/libmyodbc3.so
Server = 172.20.8.141
Database = mydb
Port = 3306
Option = 3
User = yournamehere
Password = yourpasswordhere
Installing Driver/DSN
Now we are ready to install the driver and DSN (in this order):
$ odbcinst -i -d -f /etc/odbcinst.ini
$ odbcinst -i -s -l -f /etc/odbc.ini
For clients, which cannot use system DSNs and need user-level DSNs, execute this as the user:
$ odbcinst -i -s -h -f /etc/odbc.ini
Note the h (User) instead of l (System) switch! Couldn't be more obvious, right?
Let's check if your data source is listed now:
$ odbcinst -s -q
If so, well done! ODBC is running.
You can now connect using the isql tool, where you can issue SQL statements just like with the mysql client:
isql mydsn
Pre-requisites
unixODBC needs libstc++.so.5 and libtdl.so.3, which can be easily installed using
$ yum install compat-libstdc++-33.i386 libtool-ltdl.i386 libX11 libXcursor libXext
Next, we need to install unixODBC:
$ yum install unixODBC
Then we need the ODBC Driver and Setup Library (both generic RPM version), which can be downloaded on the MySQL website.
There's a newer version 5.1 of the ODBC connector on the site, but it will not work on CentOS 5.2!
Once they are downloaded in a directory, install both using
$ rpm -Uhv *.rpm
Ok, that's the installation part. Now let's go to the configuration.
Configuration files
/etc/odbcinst.ini
[MySQL ODBC 3.51 Driver]
DRIVER = /usr/lib/libmyodbc3.so
SETUP = /usr/lib/libmyodbc3S.so
UsageCount = 1
Delete everything else, especially if there are other driver sections referring to MySQL. They will not work anyway.
/etc/odbc.ini
This file defines your DSNs. Let's take this example:
[mydsn]
Description = emma database on devel2
Driver = /usr/lib/libmyodbc3.so
Server = 172.20.8.141
Database = mydb
Port = 3306
Option = 3
User = yournamehere
Password = yourpasswordhere
Installing Driver/DSN
Now we are ready to install the driver and DSN (in this order):
$ odbcinst -i -d -f /etc/odbcinst.ini
$ odbcinst -i -s -l -f /etc/odbc.ini
For clients, which cannot use system DSNs and need user-level DSNs, execute this as the user:
$ odbcinst -i -s -h -f /etc/odbc.ini
Note the h (User) instead of l (System) switch! Couldn't be more obvious, right?
Let's check if your data source is listed now:
$ odbcinst -s -q
If so, well done! ODBC is running.
You can now connect using the isql tool, where you can issue SQL statements just like with the mysql client:
isql mydsn
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯