在使用kdb_database_link 扩展插件连接Oracle数据库时,必须先配置ODBC,确保通过ODBC能连接Oracle数据库。以下是配置ODBC的过程。
[root@dbhost03 etc]# yum install unixODBC.x86_64 [kingbase@dbhost03 kbdata]$ isql --version unixODBC 2.3.1 [kingbase@dbhost03 kbdata]$ odbcinst -j unixODBC 2.3.1 DRIVERS............: /usr/local/etc/odbcinst.ini SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources USER DATA SOURCES..: /home/kingbase/.odbc.ini SQLULEN Size.......: 8 SQLLEN Size........: 8 SQLSETPOSIROW Size.: 8
注意:如果设置了LD_LIBRARY_PATH环境变量,则实际生效的是/usr/local/etc/odbcinst.ini ,否则可能是 /etc/odbcinst.ini
根据odbcinst -j 显示的路径,配置 odbcinst.ini 和 odbc.ini 文件。
odbcinst.ini 文件内容如下:Driver 根据 下文配置的Oracle ODBC实际路径填写。
[Oracle ODBC Driver] Description = ODBC for Oracle Driver = /opt/Kingbase/ES/V8/Server/lib/libsqora.so.19.1
odbc.ini 文件内容如下:
[test_orcl] Description=Oracle Driver=Oracle ODBC Driver ServerName=test_ora UserID=USER01 Password=user01
test_ora = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS =(PROTOCOL = TCP)(Host = 192.168.237.41)(Port = 1521)) ) (CONNECT_DATA =(SID = SOGG)) )
[kingbase@dbhost03 ~]$ isql -v orcl +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+
确认连接正常。
原文:https://www.cnblogs.com/kingbase/p/14921071.html