• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

Linux上配置UnixODBC连接Oracle数据库

发布: 2007-5-25 23:40 | 作者: 佚名 | 来源: 互连网 | 查看: 282次 | 进入软件测试论坛讨论

领测软件测试网

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


作者:eygle


出处:http://blog.eygle.com


日期:January 05, 2005






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; *
* *
* http://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.sq.net.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



启动成功.




延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网