谁有centos下odbc的配置

 我来答
max的深林
推荐于2016-05-24 · TA获得超过2059个赞
知道大有可为答主
回答量:5925
采纳率:100%
帮助的人:5120万
展开全部
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
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
力控科技
2024-08-19 广告
ForceSCADA是力控科技信创产品的重要组成部分,具备完全自主知识产权,支持部署在Linux桌面版、服务器版、嵌入式等系统架构下。使用ForceSCADA可以搭建创新性高、扩展性佳、融合度强的SCADA平台,进而构建高效、智能化的监控中... 点击进入详情页
本回答由力控科技提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式