Configure unixODBC connect to Oracle 11g

前端之家收集整理的这篇文章主要介绍了Configure unixODBC connect to Oracle 11g前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


1. Check unixODBC is installed.

$ odbcinst -j

unixODBC 2.2.14

DRIVERS............: /etc/odbcinst.ini

SYSTEM DATA SOURCES: /etc/odbc.ini

FILE DATA SOURCES..: /etc/ODBCDataSources

USER DATA SOURCES..: /home/${UID}/.odbc.ini

sqlULEN Size.......: 8

sqlLEN Size........: 8

sqlSETPOSIROW Size.: 8


If not,please download fromhttp://www.unixodbc.org


2. Install Oracle 11g

...


3. Configure the Oracle ODBC Driver

$ locate libsqora

${ORACLE_HOME}/lib/libsqora.so.11.1


$ ldd ${ORACLE_HOME}/lib/libsqora.so.11.1

ldd: warning: you do not have execution permission for `${ORACLE_HOME}/lib/libsqora.so.11.1'

linux-vdso.so.1 => (0x00007fff54a3a000)

libdl.so.2 => /lib64/libdl.so.2 (0x00007f9fb6fc7000)

libm.so.6 => /lib64/libm.so.6 (0x00007f9fb6d42000)

libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f9fb6b25000)

libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f9fb690c000)

libclntsh.so.11.1 => ${ORACLE_HOME}/lib/libclntsh.so.11.1 (0x00007f9fb42e0000)

libodbcinst.so.1 => not found

libc.so.6 => /lib64/libc.so.6 (0x00007f9fb3f4e000)

/lib64/ld-linux-x86-64.so.2 (0x000000322c800000)

libnnz11.so => ${ORACLE_HOME}/lib/libnnz11.so (0x00007f9fb3b85000)

libaio.so.1 => /lib64/libaio.so.1 (0x00007f9fb3984000)


If there is libodbcinst.so.1 => not found,create a symbolic link from /usr/lib64/libodbcinst.so.1 to /usr/lib64/libodbcinst.so.2

$ cd /usr/lib64

$ sudo ln -s libodbcinst.so.2 libodbcinst.so.1


3. ConfigureOracle ODBC driver

Add following section into/etc/odbcinst.ini

[Oracle11g]

Description = Oracle ODBC driver for Oracle 11g

Driver = ${ORACLE_HOME}/lib/libsqora.so.11.1

Setup =/usr/lib64/liboraodbcS.so # this is not necessary

FileUsage =

CPTimeout =

CPReuse =

Driver Logging = 7


4. Configure Oracle User Data Source

Add following section into ~/.odbc.ini

[ORACLEORCL]

driver = Oracle11g #driver is defined in /etc/odbcinst.ini

server = localhost

port = 1521

ServerName = ORCL # this ID is configured in $ORACLE_HOME/network/admin/tnsnames.ora

UserID = scott

password = tiger


5. Verify isql can work


$ isql OracleORCL

+---------------------------------------+

| Connected! |

| |

| sql-statement |

| help [tablename] |

| quit |

| |

+---------------------------------------+

sql> select 'X' from dual;

+----+

| 'X'|

+----+

| X |

+----+

sqlRowCount returns 4294967295

1 rows fetched

sql>

原文链接:https://www.f2er.com/oracle/212233.html

猜你在找的Oracle相关文章