IT猫扑网:您身边最放心的安全下载站! 最新更新|软件分类|软件专题|手机版|论坛转贴|软件发布

您当前所在位置:首页数据库Oracle → Linux上配置Unix ODBC连接Oracle数据库

Linux上配置Unix ODBC连接Oracle数据库

时间:2015/6/28来源:IT猫扑网作者:网管联盟我要评论(0)

oracle10g前,Oracle并不提供UNIX/Linux下的ODBC驱动,用的最为广泛的是UnixOdbc,UnixOdbc的配置不算复杂,但是如果不顺利的话也会遇到一些问题。

今天成功安装配置了UnixOdbc把步骤总结一下供参考。
UnixOdbc可以在官方站点上下载。

以下是测试及配置步骤:

首先你需要安装Oracle客户端,并且确认网络可达。

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; *
* *
* https://www.unixodbc.org *
* pharvey@codebydesign.com *
* nick@easysoft.com *
**********************************************

[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) $
  root@magic.hawa.cn:/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

启动成功.

关键词标签:数据库,连接,配置gt,i

相关阅读

文章评论
发表评论

热门文章 Oracle中使用alter table来增加,删除,修改列Oracle中使用alter table来增加,删除,修改列oracle中使用SQL语句修改字段类型-oracle修oracle中使用SQL语句修改字段类型-oracle修使用低权限Oracle数据库账户得到管理员权限使用低权限Oracle数据库账户得到管理员权限Oracle对user的访问控制Oracle对user的访问控制

相关下载

人气排行 ORACLE SQL 判断字符串是否为数字的语句Oracle中使用alter table来增加,删除,修改列的语法ORACLE和SQL语法区别归纳(1)oracle grant 授权语句如何加速Oracle大批量数据处理Oracle删除表的几种方法ORACLE修改IP地址后如何能够使用Oracle 10g创建表空间和用户并指定权限