You are on page 1of 8

MySQL and Oracle Hosted in Same Machine 1) Install MySQL Database Driver.

2) In MySQL execute the following statement:


grant all on <MySQL DB Name>.* to <user_name>@'localhost' identified by <Password>;

3) In Control Panel > Administrative Tools > Data Sources (ODBC) create a System DSN for MySQL Database as shown below:

[Please note that the name given in Data Source Name, will be used as Oracle SID in TNSNAMES.ORA and LISTENER.ORA] 4) In ORACLE_HOME/hs/admin folder need to create a file init<SID>.ORA file. In this case it will be initworld.ORA with following content:
# 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 = world This has to be the SID/DNS name given HS_FDS_TRACE_LEVEL = 0 # # Environment variables required for the non-Oracle system # #set <envvar>=<value>

5) Edit Listener.ORA In SID_LIST_LISTENER add the section marked in red:


SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = CLRExtProc) (ORACLE_HOME = D:\11g_app\db\product\11.2.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:D:\11g_app\db\product\11.2.0\dbhome_1\bin\oraclr11.dll") ) (SID_DESC= (SID_NAME=world)

Should be same as DNS Name given in ODBC Configuration

(ORACLE_HOME=D:\11g_app\db\product\11.2.0\dbhome_1) (PROGRAM=dg4odbc) ) )

6) Edit TNSNAMES.ORA Add a section for the new connection:


world = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521) ) ) (CONNECT_DATA = (SID = world) ) (HS = OK) )

Should be same as DNS Name given in ODBC Configuration

Should be same as DNS Name given in ODBC Configuration

Needed to use Heterogeneous Database Connections

7) Restart Listener services. 8) Create a Database link:


CREATE DATABASE LINK mysql6 CONNECT TO TEST_USER IDENTIFIED BY TEST USING world;

MySQL and Oracle Hosted in Different Machine 1) Install MySQL Database Driver if not installed. 2) In MySQL execute the following statement:
grant all on <MySQL DB Name>.* to <user_name>@<Host/IP address where Oracle DB is Hosted> identified by <Password>;

3) In Control Panel > Administrative Tools > Data Sources (ODBC) create a System DSN for MySQL Database as shown below:

[Please note that the name given in Data Source Name, will be used as Oracle SID in TNSNAMES.ORA and LISTENER.ORA] 4) In ORACLE_HOME/hs/admin folder need to create a file init<SID>.ORA file. In this case it will be initsakila_kris.ORA with following content:
# 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 = sakila_kris This has to be the SID/DNS name given HS_FDS_TRACE_LEVEL = 0 # # Environment variables required for the non-Oracle system # #set <envvar>=<value>

5) Edit Listener.ORA In SID_LIST_LISTENER add the section marked in red:


SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = CLRExtProc) (ORACLE_HOME = D:\11g_app\db\product\11.2.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:D:\11g_app\db\product\11.2.0\dbhome_1\bin\oraclr11.dll") ) (SID_DESC= (SID_NAME=world) (ORACLE_HOME=D:\11g_app\db\product\11.2.0\dbhome_1) (PROGRAM=dg4odbc) ) (SID_DESC= (SID_NAME=sakila_kris)

Should be same as DNS Name given in ODBC Configuration

(ORACLE_HOME=D:\11g_app\db\product\11.2.0\dbhome_1) (PROGRAM=dg4odbc) ) )

6) Edit TNSNAMES.ORA Add a section for the new connection:


sakila_kris = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = AP-BGLR-WS0212.corp.sct.com) (PORT = 1521) ) ) (CONNECT_DATA = (SID = sakila_kris) )

Should be same as DNS Name given in ODBC Configuration

Should be same as DNS Name given in ODBC Configuration

(HS = OK) )

Needed to use Heterogeneous Database Connections

7) Restart Listener services. 8) Create a Database link:


CREATE DATABASE LINK mysql7 CONNECT TO root IDENTIFIED BY TEST USING sakila_kris;

SQL Server and Oracle Hosted in Different Machine

1) In Control Panel > Administrative Tools > Data Sources (ODBC) create a System DSN for SQLServer:

[Please note that the name given in Data Source Name, will be used as Oracle SID in TNSNAMES.ORA and LISTENER.ORA] 2) In ORACLE_HOME/hs/admin folder need to create a file init<SID>.ORA file. In this case it will be initSQL-Server.ORA with following content:
# 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 = SQL-Server This has to be the SID/DNS name given HS_FDS_TRACE_LEVEL = 0 # # Environment variables required for the non-Oracle system

# #set <envvar>=<value>

3) Edit Listener.ORA In SID_LIST_LISTENER add the section marked in red:


SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = CLRExtProc) (ORACLE_HOME = D:\11g_app\db\product\11.2.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:D:\11g_app\db\product\11.2.0\dbhome_1\bin\oraclr11.dll") ) (SID_DESC= (SID_NAME=world) (ORACLE_HOME=D:\11g_app\db\product\11.2.0\dbhome_1) (PROGRAM=dg4odbc) ) (SID_DESC= (SID_NAME=sakila_kris) (ORACLE_HOME=D:\11g_app\db\product\11.2.0\dbhome_1) (PROGRAM=dg4odbc) ) (SID_DESC= (SID_NAME=SQL-Server)

Should be same as DNS Name given in ODBC Configuration

(ORACLE_HOME=D:\11g_app\db\product\11.2.0\dbhome_1) (PROGRAM=dg4odbc) ) )

4) Edit TNSNAMES.ORA Add a section for the new connection:


SQL-Server = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)

Should be same as DNS Name given in ODBC Configuration

(HOST = AP-BGLR-WS0212.corp.sct.com) (PORT = 1521) ) ) (CONNECT_DATA = (SID = SQL-Server) ) (HS = OK) )

Should be same as DNS Name given in ODBC Configuration

Needed to use Heterogeneous Database Connections

5) Restart Listener services. 6) Create a Database link:


CREATE DATABASE LINK sqlser6 CONNECT TO username IDENTIFIED BY password USING SQL-Server;

You might also like