一、检查环境
本文介绍unixODBC-2.3.0.tar.gz的安装。
检查是否安装gcc
rpm -qa | grep gcc
如未安装,需挂载安装镜像,配置本地yum源,安装gcc:
yum install gcc gcc-c++ -y
二、安装ODBC
[root@localhost ~]# #解压unixODBC-2.3.0.tar.gz
[root@localhost ~]# tar -xvf unixODBC-2.3.0.tar.gz
[root@localhost ~]# #进入解压目录
[root@localhost ~]# cd unixODBC-2.3.0/
[root@localhost ~]# #配置、编译、安装
[root@localhost unixODBC-2.3.0]# ./configure
[root@localhost unixODBC-2.3.0]# make
[root@localhost unixODBC-2.3.0]# make install
[root@localhost unixODBC-2.3.0]# #查看odbc版本
[root@localhost unixODBC-2.3.0]# odbc_config --version
2.3.0
[root@localhost unixODBC-2.3.0]# #查看配置文件路径
[root@localhost unixODBC-2.3.0]# odbcinst -j
unixODBC 2.3.0
DRIVERS............: /usr/local/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini
FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
三、配置ODBC
配置/usr/local/etc/odbc.ini文件
[root@localhost unixODBC-2.3.0]# cat /usr/local/etc/odbc.ini
[dm8]
Description = DM ODBC DSN
Driver = DM8 ODBC DRIVER
SERVER = localhost
UID = SYSDBA
PWD = SYSDBA
TCP_PORT = 5237
配置/usr/local/etc/odbcinst.ini文件
[root@localhost unixODBC-2.3.0]# cat /usr/local/etc/odbcinst.ini
[DM8 ODBC DRIVER]
Description = ODBC DRIVER FOR DM8
DRIVER= /dm/bin/libdodbc.so
四、连接测试
[dmdba@localhost ~]$ isql -v dm8
连接成功
创建表进行测试
通过disql登陆查询验证