关闭

Win8.1环境下配置oracle gateway for mysql(odbc)

标签: oraclemysqlgatewaywin864bit
1136人阅读 评论(0) 收藏 举报
分类:


一、环境说明
Oracle12c与gateway部署在Win8.1系统的同一台机器上,Mysql部署在Ubuntu上。

gateway版本:winx64_12102_gateways
Oracle版本:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
PL/SQL Release 12.1.0.2.0 - Production
CORE 12.1.0.2.0 Production
TNS for 64-bit Windows: Version 12.1.0.2.0 - Production
NLSRTL Version 12.1.0.2.0 - Production
Mysql版本:5.5.44-0ubuntu0.14.04.1


二、部署过程
1、下载oracle gateway软件
下载对应的window64版本,winx64_12102_gateways.zip
可以用注册账号到Oracle官网上去下载。
2、配置ODBC
在windos上通过管理工具配置ODBC到时Mysql的连接,通常需要下载安装Mysql的ODBC驱动包。
本次配置使用的是mysql-connector-odbc-5.2.7-winx64.msi
3、配置三个配置文件
C:\app\tg\Administrator\product\12.1.0\tghome_1\NETWORK\ADMIN下的listener.ora
C:\app\oracle\product\12.1.0\dbhome_1\NETWORK\ADMIN下的tnsnames.ora
C:\app\tg\Administrator\product\12.1.0\tghome_1\hs\admin下的initmysql.ora(从initdg4odbc.ora复制修改而来
对应文件内容如下:
initmysql.ora

# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC

# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC

#
# HS init parameters
#
#HS_FDS_CONNECT_INFO =      ---原文件没有注释掉,配置的时候要注释。
#HS_FDS_TRACE_LEVEL =      ---原文件没有注释掉,配置的时候要注释。
#HS_FDS_SHAREABLE_NAME =      ---原文件没有注释掉,配置的时候要注释。

#
# ODBC specific environment variables
#
#set ODBCINI=     ---原文件没有注释掉,配置的时候要注释。


#
# Environment variables required for the non-Oracle system
#
#set =

HS_FDS_CONNECT_INFO=dw-mysql-64
HS_FDS_TRACE_LEVEL=off
#HS_FDS_TRACE_FILE_NAME=mysql.trc
#HS_FDS_SHAREABLE_NAME=/usr/lib64/libmyodbc5.so
#set ODBCINI=/etc/odbc.ini
其中,HS_FDS_CONNECT_INFO=dw-mysql-64,对应的是WinODBC上配置的连接名。

listener.ora

# listener.ora Network Configuration File: C:\app\tg\Administrator\product\12.1.0\tghome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = datahouse)(PORT = 1523))     
    )
  )
)

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = mysql)
      (ORACLE_HOME = C:\app\tg\Administrator\product\12.1.0\tghome_1\)
      (PROGRAM = dg4odbc)
    )
  )

其中,PROGRAM = dg4odbc,不用动,也不能动;SID_NAME = mysql对应initmysql.ora文件名!


tnsnames.ora

# tnsnames.ora Network Configuration File: C:\app\oracle\product\12.1.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = datahouse)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

logdata_mysql =
   (DESCRIPTION=
     (ADDRESS=(PROTOCOL=tcp)(HOST= datahouse)(PORT=1523))
     (CONNECT_DATA=(SID=mysql))
     (HS=ok)
    )

其中,initmysql.ora和listener.ora是gateway端配置,tnsnames.ora是Oracle服务端配置

4、建DBLINK
在连接Oracle的服务端操作

-- Create database link 
create database link LOGDATA_MYSQL
  connect to datahs identified by "password"
  using 'logdata_mysql';

5、测试

select * from "wt2oracle"(E)logdata_mysql;
create_date	ip	web_desc	url_from	url_current	token	add_time
2015-09-0	10.51.33.13	/cart/dormpostweb	http://yemao.59store.com/dorm/122732	http://yemao.59store.com/cart/dormpostweb	3171899a2a91b71d08a7dc21c22d7b18	1441698657
2015-09-0	10.51.33.13	/app/download/dorm.html				1441698657
2015-09-0	10.51.33.13	/app/download/dorm.html				1441698657

三、其他
在配置过程中,侦听要分清,是要配置gateway端的侦听;initmysql.ora是要配置连接mysql数据库的肯定也配置gateway端;tnsnames.ora配置在Oracle服务端,添加通过Gateway连接Mysql的通讯配置;在配置的过程中,经常会出现一些莫名的问题,有时候可能就是中文空格字符串的问题,需要耐心的去解决。



1
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:401083次
    • 积分:4109
    • 等级:
    • 排名:第7548名
    • 原创:123篇
    • 转载:12篇
    • 译文:0篇
    • 评论:33条
    最新评论