IT貓撲網(wǎng):您身邊最放心的安全下載站! 最新更新|軟件分類|軟件專題|手機版|論壇轉(zhuǎn)貼|軟件發(fā)布

您當前所在位置: 首頁數(shù)據(jù)庫Oracle → Linux上配置Unix ODBC連接Oracle數(shù)據(jù)庫

Linux上配置Unix ODBC連接Oracle數(shù)據(jù)庫

時間:2015-06-28 00:00:00 來源:IT貓撲網(wǎng) 作者:網(wǎng)管聯(lián)盟 我要評論(0)

Oracle10g前,Oracle并不提供UNIX/Linux下的ODBC驅(qū)動,用的最為廣泛的是UnixOdbc,UnixOdbc的配置不算復雜,但是如果不順利的話也會遇到一些問題。

今天成功安裝配置了UnixOdbc把步驟總結(jié)一下供參考。
UnixOdbc可以在官方站點上下載。

以下是測試及配置步驟:

首先你需要安裝Oracle客戶端,并且確認網(wǎng)絡可達。

1.使用isql進行測試

[root@magic root]# isql
**********************************************
* unixODBC - isql *
**********************************************
* Syntax *
* *
* isql DSN [UID [PWD]] [options] *
* *
* Options *
* *
* -b batch.(no prompting etc) *
* -dx delimit columns with x *
* -x0xXX delimit columns with XX, where *
* x is in hex, ie 0x09 is tab *
* -w wrap results in an HTML table *
* -c column names on first row. *
* (only used when -d) *
* -mn limit column display width to n *
* -v verbose. *
* -lx set locale to x *
* --version version *
* *
* Notes *
* *
* isql supports redirection and piping *
* for batch processing. *
* *
* Examples *
* *
* cat My.sql | isql WebDB MyID MyPWD -w *
* *
* Each line in My.sql must contain *
* exactly 1 SQL command except for the *
* last line which must be blank. *
* *
* Please visit; *
* *
* http://www.unixodbc.org *
* [email protected] *
* [email protected] *
**********************************************

[root@magic root]# isql --versio
unixODBC 2.2.10
[root@magic root]# which isql
/usr/bin/isql

2./etc/odbc.ini文件配置

[ODBC Data Sources]
test = Oracle ODBC Driver DSN

[default]
Driver = /usr/local/easysoft/oracle/libesoracle.so

[test]
Driver = /usr/local/easysoft/oracle/libesoracle.so

Description = Oracle
server = 172.16.1.21
ServerType = Oracle
Port = 1521
User = username
Password = password
Database = ava
SID = ava
METADATA_ID = 0
ENABLE_USER_CATALOG = 1
ENABLE_SYNONYMS = 1

[default]
Driver = /usr/local/easysoft/oracle/libesoracle.so

3. /etc/odbcinst.ini 文件配置

;
; odbcinst.ini
;

[test]
Description=ODBC for ORACLE
Driver = /usr/local/easysoft/oracle/libesoracle.so

[ODBC]
Trace=1
Debug=1
Pooling=No

4.sqlnet.ora文件配置

NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)

5.tnsnames.ora文件配置

ava =
? (DESCRIPTION =
??? (ADDRESS_LIST =
????? (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.18.21)(PORT = 1521))
??? )
??? (CONNECT_DATA =
????? (SID = ava)
??? )
? )

6.測試

[root@magic admin]# isql test -v
+---------------------------------------+
| Connected!??? |
|?? |
| sql-statement |
| help [tablename]??? |
| quit??? |
|?? |
+---------------------------------------+
SQL>

7.啟動LDAP

[root@magic admin]# /usr/local/libexec/slapd -d 5 -f /home/eygle/openldap/slapd.conf
@(#) $OpenLDAP: slapd 2.2.17 (Dec 29 2004 20:45:12) $
? [email protected]:/home/eygle/openldap/openldap-2.2.17/servers/slapd
daemon_init:
daemon_init: listen on ldap:///
daemon_init: 1 listeners to open...
ldap_url_parse_ext(ldap:///)
daemon: IPv6 socket() failed errno=97 (Address family not supported by protocol)
daemon: initialized ldap:///
daemon_init: 2 listeners opened
slapd init: initiated server.
==>backsql_initialize()
<==backsql_initialize()
>>> dnNormalize:
=> ldap_bv2dn(cn=Subschema,0)
ldap_err2string
<= ldap_bv2dn(cn=Subschema)=0 Success
=> ldap_dn2bv(272)
ldap_err2string
....
==>backsql_open_db_conn()
backsql_open_db_conn(): connected, adding to tree
<==backsql_open_db_conn()
backsql_get_db_conn(): first call -- reading schema map
==>backsql_load_schema_map()
ldapinfo.dn_ru field exists in the schema
backsql_load_schema_map(): at_query "SELECT name,sel_expr,from_tbls,join_where,add_proc,delete_proc,param_order,
expect_return,sel_expr_u FROM ldap_attr_mappings WHERE oc_map_id=?"
<==backsql_load_schema_map()
<==backsql_get_db_conn()
==>backsql_free_db_conn()
backsql_free_db_conn(): closing db connection
==>backsql_close_db_conn()
<==backsql_close_db_conn()
<==backsql_free_db_conn()
<==backsql_db_open(): test succeeded, schema map loaded
slapd starting

啟動成功.

關鍵詞標簽:數(shù)據(jù)庫,連接,配置gt,i

相關閱讀

文章評論
發(fā)表評論

熱門文章 Oracle中使用alter table來增加,刪除,修改列的語法 Oracle中使用alter table來增加,刪除,修改列的語法 oracle中使用SQL語句修改字段類型-oracle修改SQL語句案例 oracle中使用SQL語句修改字段類型-oracle修改SQL語句案例 誤刪Oracle數(shù)據(jù)庫實例的控制文件 誤刪Oracle數(shù)據(jù)庫實例的控制文件 為UNIX服務器設置Oracle全文檢索 為UNIX服務器設置Oracle全文檢索

相關下載

    人氣排行 oracle中使用SQL語句修改字段類型-oracle修改SQL語句案例 Oracle中使用alter table來增加,刪除,修改列的語法 ORACLE SQL 判斷字符串是否為數(shù)字的語句 ORACLE和SQL語法區(qū)別歸納(1) oracle grant 授權(quán)語句 ORACLE修改IP地址后如何能夠使用 如何加速Oracle大批量數(shù)據(jù)處理 Oracle刪除表的幾種方法