SlideShare a Scribd company logo
3
Most read
4
Most read
5
Most read
DATABASE LINK FROM ORACLE TO MYSQL
Introduction
This document describe steps to create database link between oracle to MySQL (Heterogeneous
Services) / Oracle Gateway, Regarding to Oracle Documentation Gateways will integrate with any
number of non-Oracle systems from an Oracle application.
Environment:-
Operating System: Solaris 11.1
Database: - 11.2.0.3
In my case Grid Infrastructure installed on both node, so I choose one node to configure database link.
Software Needed:-
1- UnixODBC (Generic), Download From here.
2- MySQL ODBC/Connector, Download From Here.
Notes:-
Command Line will be in Red Color.
Output for command Line will be in Blue Color.
DATABASE LINK FROM ORACLE TO MYSQL
About the Author
Osama Mustafa has progressive experience in Oracle Products, community. He recently served as
Oracle Database Administrator.
Provide Database Implementation Solutions, High Availability Solution, Infrastructure and Storage
Planning, Install, Configure, Implement and manage Oracle E-Business Suite environments. Architect,
build and support highly-available Oracle EBS, Database and Fusion Middleware environments including
appropriate reporting, Installs, configures, upgrades, tunes, and maintains production, development and
test databases.
He entered Oracle ACE Program in 2013, he is author for the book Oracle Penetration Testing, Osama
Mustafa Certified OCP 10g,11g, Linux Implementations , Certified Ethical hacker and LPT , and Solaris
Administrator.
Include to all this Osama Mustafa is international Speaker in Oracle User Group and Oracle OTN Tour,
Published Online Articles in His blog about Oracle Technology.
Twitter: @OsamaOracle
G+: Osama Mustafa
SlidShare: Osama Mustafa
LinkedIn: http://www.linkedin.com/in/osamamustafa
Blog: https://osamamustafa.blogpsot.com.
DATABASE LINK FROM ORACLE TO MYSQL
To start Configure Database Link you need to follow the below steps first, to make easier I already upload
the necessary files you will need on my account here: -
https://github.com/OsamaOracle/db4odbc.git
You Can Download it and Change Path depend on files and Library Locations, You can create your entire
in Listener.ora and Tnsnames.ora but Sometimes problem related to space and “(“ “)” will show up.
Step #1:-
Determine Version for dg4odbc on Operating system using
file $ORACLE_HOME/bin/dg4odbc
ELF 64-bit LSB executable, Intel x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically
linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
This Command Explain which version of ODBC Driver I should use Which 64 bit.
Step #2:-
(This step should be done as root user).
It’s Time to Download and Install unixODBC, I will assume you already download the file and upload to
the server, I am using Solaris 11.2 but as I already mentioned before I will build unixODBC manually
therefore I will not use unixODBC.pkg.
In the website http://unixODBC.org they already mentioned step to configure it but I will re mention it here
again.
I prefer to setup and configure unixODBC under /usr/local/unixODBC.
Installation Steps:-
# unzip unixODBC.
DATABASE LINK FROM ORACLE TO MYSQL
# cd UnixODBC.
# export CFLAGS="-m64"
# ./configure --prefix=/usr/local/unixODBC
# make
# make install
Step #3:-
(As Oracle User).
Now unixODBC installed and configured under /usr/local/unixODBC, Next Step Download MySQL ODBC
Connecter, Choose the right one for your OS depend on MySQL Version.
Upload connector to the server and unzip it only (without do anything else) under /u01/app/oracle/.
Step #4:-
(As Oracle User).
Export Variables.
In Linux  .bash_profile
In Solairs  .profile
First Variable:-
export LD_LIBRARY_PATH=
/u01/app/oracle/product/11.2.0/db_home1/lib32:/usr/local/unixODBC/lib/:/u01/app/oracle/mysql-
connector-odbc-5.1.6-solaris11-x86-32bit/lib/libmyodbc5.so
Second Variable:-
export ODBCINI=/usr/local/unixODBC/etc/odbc.ini
export ODBCSYSINI= /usr/local/unixODBC/etc
This step is very important and without will cause problem with Library.
DATABASE LINK FROM ORACLE TO MYSQL
Step #5:-
( As Root User ).
Configure odbc.ini located in ( /usr/local/unixODBC/etc ), the file should look like the below :-
[DSN-NAME]
Driver = /u01/app/oracle/mysql-connector-odbc-3.51.30-solaris10-sparc-64bit/lib/libmyodbc3.so
DATABASE = <MySQL-Database-name>
DESCRIPTION = MySQL ODBC 5.2.5 Connector Sample
PORT =<listing Port for MySQL> Default 3306
SERVER = < MySQL Server IP >
UID= username
PWD = password (should be complex).
Option=3
Examples:-
[MySQL]
Driver = /u01/app/oracle/mysql-connector-odbc-3.51.30-solaris10-sparc-
64bit/lib/libmyodbc3.so
DATABASE = 4s
DESCRIPTION = MySQL ODBC 5.2.5 Connector Sample
PORT = 3306
SERVER = 172.16.2.120
UID= root
PWD = Osama123
Option=3
It’s configured.
DATABASE LINK FROM ORACLE TO MYSQL
Step #6:-
I choose to put this as steps because it will avoid time wasting which library test.
As Oracle User:-
# ldd libmyodbc3.so
The output will be like:-
libsocket.so.1 => /lib/64/libsocket.so.1
libnsl.so.1 => /lib/64/libnsl.so.1
libm.so.2 => /lib/64/libm.so.2
librt.so.1 => /lib/64/librt.so.1
libz.so.1 => /lib/64/libz.so.1
libodbcinst.so.1 => /usr/lib/64/libodbcinst.so.1
libdl.so.1 => /lib/64/libdl.so.1
libthread.so.1 => /lib/64/libthread.so.1
libc.so.1 => /lib/64/libc.so.1
libmp.so.2 => /lib/64/libmp.so.2
libmd.so.1 => /lib/64/libmd.so.1
libltdl.so.7 => /usr/lib/64/libltdl.so.7
libpthread.so.1 => /lib/64/libpthread.so.1
libcryptoutil.so.1 => /lib/64/libcryptoutil.so.1
/lib/sparcv9/../libm/sparcv9/libm_hwcap1.so.2
The Most Important thing in the above output to check if there is nothing in library “Not Found”
Step #7:-
(As oracle User).
DATABASE LINK FROM ORACLE TO MYSQL
Test connection using odbc only, Only on OS Level, go the /usr/local/unixODBC/bin.
# ./isql –v [DSN-NAME]
Example:-
# ./isql –v MySQL.
The below is output:-
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
Until this step you didn’t do anything only configure odbc, next step will explain how to configure Oracle.
Step #8:-
DATABASE LINK FROM ORACLE TO MYSQL
Configuration for Oracle Start with initSID.ora file. Oracle already create template located in
$ORACLE_HOME/hs/admin just copy with new name, the default one initdg4odbc.ora you can leave
without change and edit it.
Edit the file and set the new variables like the below:-
#
#HS init parameters
#
HS_FDS_CONNECT_INFO= [DSN_NAME]  same as odbc.ini
HS_FDS_TRACE_LEVEL= DEBUG  Trace level.
HS_FDS_SHAREABLE_NAME= /usr/local/unixODBC/lib/libodbc.so
HS_FDS_SUPPORT_STATISTICS= FALSE
HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P1
#HS_NLS_DATE_FORMAT=YYYY-MM-DD
#
# ODBC specific environment variables
#
set ODBCINI=/usr/local/unixODBC/etc/odbc.ini
Example:-
#
#HS init parameters
#
HS_FDS_CONNECT_INFO= MySQL
HS_FDS_TRACE_LEVEL= off
HS_FDS_SHAREABLE_NAME= /usr/local/unixODBC/lib/libodbc.so
HS_FDS_SUPPORT_STATISTICS= FALSE
HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P1
#HS_NLS_DATE_FORMAT=YYYY-MM-DD
#
# ODBC specific environment variables
#
set ODBCINI=/usr/local/unixODBC/etc/odbc.ini
Step #9:
DATABASE LINK FROM ORACLE TO MYSQL
This Step will describe how to configure Listener.ora, You can download Listener.ora and copy/Paste the
entire to make sure there’s nothing wrong or you can create your own.
Open Listener.ora and add the below line depend on your Configuration :-
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=dg4odbc)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_home1)
(ENVS=LD_LIBRARY_PATH=/usr/local/unixODBC/lib:/u01/app/oracle/product/11.2.0/db_home1
/lib:/u01/app/oracle/mysql-connector-odbc-3.51.30-solaris10-sparc-64bit/lib)
(PROGRAM=dg4odbc)
)
)
Some Notes about the above:-
1- SID_LIST_LISTENER  Indicate to your LISTENER NAME.
2- SID_NAME= Depend init….ora file.
3- Change ORACLE_HOME.
4- LD_LIBRARY_PATH Depend where you installed unixODBC and MySQL connecter.
5- Program Indicate to init…ora name.
Now After edit Listener.ora Save it, this step require to restart Listener.ora
LSNRCTL > stop LISTENER
LSNRCTL > Start LISTENER
Output:-
DATABASE LINK FROM ORACLE TO MYSQL
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Solaris: Version 11.2.0.3.0 - Production
Start Date 16-JUN-2014 15:51:47
Uptime 0 days 1 hr. 50 min. 11 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/Node1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Node1)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Node2)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "PRDSBL" has 1 instance(s).
Instance "PRDSBL1", status READY, has 1 handler(s) for this service...
Service "PRDSBLXDB" has 1 instance(s).
Instance "PRDSBL1", status READY, has 1 handler(s) for this service...
Service "dg4odbc" has 1 instance(s).
Instance "dg4odbc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
Step #10:-
Finally add new entire to tnsnames.ora
dg4odbc =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=sbl-prd-db1)(PORT=1521))
(CONNECT_DATA=(SID=dg4odbc))
(HS=OK)
)
tnsping dg4odbc should work.
Step #11:-
DATABASE LINK FROM ORACLE TO MYSQL
SQL > create public database link <DB-LINK-NAME> connect "usename" identified by "password" using
'odbc';
Notes:
1- Username & password should be the same as odbc.ini ( in my case root and Osama123);
2- Tnsnames.ora should be the same as entire in tnsnames.ora.
Now Test it :-
SQL > Select * from “Table-name”@DB-Link
Reference:-
 How to Resolve Common Errors Encountered while using Database Gateways (DG4IFMX,
Dg4MSQL, DG4SYBS), DG4ODBC or Generic Connectivity (Doc ID 234517.1)
 Database Gateway and Generic Connectivity (DG4ODBC) Licensing Considerations (Doc ID
232482.1)
 Gateway Configuration Utility for Database Gateway for ODBC - DG4ODBC - to Connect to Non-
Oracle Databases For Example - DB2, SQL*Server, Sybase, Informix, MySQL (Doc ID 1274143.1)
 Master Note for Oracle Gateway Products (Doc ID 1083703.1)
 What Are The Options To Connect From Oracle Via a Database Link Using DG4ODBC To MySQL
Using An ODBC Driver? (Doc ID 1526864.1)
Thank you
Osama Mustafa
Oracle ACE.

More Related Content

What's hot (20)

PDF
Understanding oracle rac internals part 1 - slides
Mohamed Farouk
 
PPT
Mysql database
Arshikhan08
 
PPTX
Sharding Methods for MongoDB
MongoDB
 
PPTX
Introduction to Redis
TO THE NEW | Technology
 
PDF
High Performance Solr
Shalin Shekhar Mangar
 
PDF
DB2 TABLESPACES
Rahul Anand
 
PDF
"It can always get worse!" – Lessons Learned in over 20 years working with Or...
Markus Michalewicz
 
PDF
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
John Beresniewicz
 
PDF
ORACLE ARCHITECTURE
Manohar Tatwawadi
 
PDF
An introduction to MongoDB
Universidade de São Paulo
 
PDF
Linux tuning to improve PostgreSQL performance
PostgreSQL-Consulting
 
PPTX
Android - ADB
Yossi Gruner
 
PDF
A deep dive about VIP,HAIP, and SCAN
Riyaj Shamsudeen
 
PPTX
Group By, Order By, and Aliases in SQL
MSB Academy
 
PDF
How to find what is making your Oracle database slow
SolarWinds
 
PDF
Postgresql database administration volume 1
Federico Campoli
 
PDF
Hybrid Data Guard to Cloud GEN2 ExaCS.pdf
ALI ANWAR, OCP®
 
PDF
Vacuum in PostgreSQL
Rafia Sabih
 
PPTX
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Library
jexp
 
PDF
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
Kenny Gryp
 
Understanding oracle rac internals part 1 - slides
Mohamed Farouk
 
Mysql database
Arshikhan08
 
Sharding Methods for MongoDB
MongoDB
 
Introduction to Redis
TO THE NEW | Technology
 
High Performance Solr
Shalin Shekhar Mangar
 
DB2 TABLESPACES
Rahul Anand
 
"It can always get worse!" – Lessons Learned in over 20 years working with Or...
Markus Michalewicz
 
DB Time, Average Active Sessions, and ASH Math - Oracle performance fundamentals
John Beresniewicz
 
ORACLE ARCHITECTURE
Manohar Tatwawadi
 
An introduction to MongoDB
Universidade de São Paulo
 
Linux tuning to improve PostgreSQL performance
PostgreSQL-Consulting
 
Android - ADB
Yossi Gruner
 
A deep dive about VIP,HAIP, and SCAN
Riyaj Shamsudeen
 
Group By, Order By, and Aliases in SQL
MSB Academy
 
How to find what is making your Oracle database slow
SolarWinds
 
Postgresql database administration volume 1
Federico Campoli
 
Hybrid Data Guard to Cloud GEN2 ExaCS.pdf
ALI ANWAR, OCP®
 
Vacuum in PostgreSQL
Rafia Sabih
 
APOC Pearls - Whirlwind Tour Through the Neo4j APOC Procedures Library
jexp
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
Kenny Gryp
 

Viewers also liked (20)

PDF
How to add storage to esxi 5.5
Osama Mustafa
 
PDF
Erp installation r12.2
Osama Mustafa
 
PDF
J2ee user managment using dwh builder
Osama Mustafa
 
PDF
Installing oracle timesten database On Linux
Osama Mustafa
 
PDF
Enable Mobile Apps Designer in OBIEE
Osama Mustafa
 
DOCX
Upgrade EBS DB from 11g to 12c.
Osama Mustafa
 
PDF
Install oracle solaris 11.2 using gui
Osama Mustafa
 
PDF
Oracle autovue
Osama Mustafa
 
DOCX
Discoverer 11.1.1.7 web logic (10.3.6) & ebs r12 12.1.3) implementation guide...
ginniapps
 
PDF
Ebs clone r12.2.4
Osama Mustafa
 
PDF
Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1
Osama Mustafa
 
PDF
OBIA Installation
Osama Mustafa
 
PDF
Install oracle grid infrastructure on linux 6.6
Osama Mustafa
 
PDF
Install oracle siebel on windows 2008 r2
Osama Mustafa
 
PDF
How to apply new patch on siebel 8.2.2.4
Osama Mustafa
 
PDF
Oracle obia 11.1.1.10.1 installation
Osama Mustafa
 
PDF
Oracle Access Manager Overview
guestf6dc99b
 
PDF
Deploy agent in em12c
Osama Mustafa
 
PDF
Rac&asm
Osama Mustafa
 
PDF
Refresh development from productions
Osama Mustafa
 
How to add storage to esxi 5.5
Osama Mustafa
 
Erp installation r12.2
Osama Mustafa
 
J2ee user managment using dwh builder
Osama Mustafa
 
Installing oracle timesten database On Linux
Osama Mustafa
 
Enable Mobile Apps Designer in OBIEE
Osama Mustafa
 
Upgrade EBS DB from 11g to 12c.
Osama Mustafa
 
Install oracle solaris 11.2 using gui
Osama Mustafa
 
Oracle autovue
Osama Mustafa
 
Discoverer 11.1.1.7 web logic (10.3.6) & ebs r12 12.1.3) implementation guide...
ginniapps
 
Ebs clone r12.2.4
Osama Mustafa
 
Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1
Osama Mustafa
 
OBIA Installation
Osama Mustafa
 
Install oracle grid infrastructure on linux 6.6
Osama Mustafa
 
Install oracle siebel on windows 2008 r2
Osama Mustafa
 
How to apply new patch on siebel 8.2.2.4
Osama Mustafa
 
Oracle obia 11.1.1.10.1 installation
Osama Mustafa
 
Oracle Access Manager Overview
guestf6dc99b
 
Deploy agent in em12c
Osama Mustafa
 
Rac&asm
Osama Mustafa
 
Refresh development from productions
Osama Mustafa
 
Ad

Similar to Oracle to MySQL DatabaseLink (20)

PDF
Usage Note of Qt ODBC Database Access on Linux
William Lee
 
DOCX
2nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp02
shaikyunus1980
 
DOCX
RAC 12c
Waseem Shahzad
 
DOCX
Using microsoft odbc and oracle gateway
Andy Liu
 
PDF
12c (12.1) Database installation on Solaris 11(11.2)
K Kumar Guduru
 
ODP
Asian Spirit 3 Day Dba On Ubl
newrforce
 
PDF
Installing oracle grid infrastructure and database 12c r1
Voeurng Sovann
 
PDF
Rac on NFS
mengjiagou
 
DOCX
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Yury Velikanov
 
PDF
Oracle 12c Multi Process Multi Threaded
Markus Flechtner
 
DOCX
Oracle 12cR2 RAC Database Software Installation and Create Database
Monowar Mukul
 
PDF
Create your oracle_apps_r12_lab_with_less_than_us1000
Ajith Narayanan
 
PDF
My First 100 days with a MySQL DBMS (WP)
Gustavo Rene Antunez
 
PDF
Oracle 11g R2 RAC setup on rhel 5.0
Santosh Kangane
 
PPTX
BDM32: AdamCloud Project - Part II
David Lauzon
 
PDF
Oracle olap-installation
Amit Sharma
 
DOCX
Vbox virtual box在oracle linux 5 - shoug 梁洪响
maclean liu
 
PDF
SULTHAN's PHP, MySQL & wordpress
SULTHAN BASHA
 
PDF
MySQL JSON Functions
Sveta Smirnova
 
PPT
Mysql ppt
Sanmuga Nathan
 
Usage Note of Qt ODBC Database Access on Linux
William Lee
 
2nodesoracle12craconyourlaptopvirtualboxstepbystepguide1 0-130627143310-phpapp02
shaikyunus1980
 
Using microsoft odbc and oracle gateway
Andy Liu
 
12c (12.1) Database installation on Solaris 11(11.2)
K Kumar Guduru
 
Asian Spirit 3 Day Dba On Ubl
newrforce
 
Installing oracle grid infrastructure and database 12c r1
Voeurng Sovann
 
Rac on NFS
mengjiagou
 
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Yury Velikanov
 
Oracle 12c Multi Process Multi Threaded
Markus Flechtner
 
Oracle 12cR2 RAC Database Software Installation and Create Database
Monowar Mukul
 
Create your oracle_apps_r12_lab_with_less_than_us1000
Ajith Narayanan
 
My First 100 days with a MySQL DBMS (WP)
Gustavo Rene Antunez
 
Oracle 11g R2 RAC setup on rhel 5.0
Santosh Kangane
 
BDM32: AdamCloud Project - Part II
David Lauzon
 
Oracle olap-installation
Amit Sharma
 
Vbox virtual box在oracle linux 5 - shoug 梁洪响
maclean liu
 
SULTHAN's PHP, MySQL & wordpress
SULTHAN BASHA
 
MySQL JSON Functions
Sveta Smirnova
 
Mysql ppt
Sanmuga Nathan
 
Ad

More from Osama Mustafa (17)

PDF
Case study for software architect
Osama Mustafa
 
PPTX
DevOps for database
Osama Mustafa
 
PPTX
Does cloud mean the end of the dba
Osama Mustafa
 
PDF
Using git hub for your code
Osama Mustafa
 
PDF
DevOps Project
Osama Mustafa
 
PDF
Java business service
Osama Mustafa
 
PDF
Steps creating data_integration_services
Osama Mustafa
 
PDF
Build, Deploy and Run Node Js Application on Azure using Docker
Osama Mustafa
 
PDF
Oracle api gateway installation as cluster and single node
Osama Mustafa
 
PDF
Helping implementer dealing with famous siebel based system messages and er...
Osama Mustafa
 
PPTX
Weblogic and docker
Osama Mustafa
 
PPTX
Weblogic 101 for dba
Osama Mustafa
 
PDF
Oracle Enterprise manager 13c Installation
Osama Mustafa
 
PPTX
Eouc 12 on 12c osama mustafa
Osama Mustafa
 
PDF
Enable oracle database vault
Osama Mustafa
 
PDF
12c on RHEL7
Osama Mustafa
 
PDF
Weblogic 12c installation (oracle linux)
Osama Mustafa
 
Case study for software architect
Osama Mustafa
 
DevOps for database
Osama Mustafa
 
Does cloud mean the end of the dba
Osama Mustafa
 
Using git hub for your code
Osama Mustafa
 
DevOps Project
Osama Mustafa
 
Java business service
Osama Mustafa
 
Steps creating data_integration_services
Osama Mustafa
 
Build, Deploy and Run Node Js Application on Azure using Docker
Osama Mustafa
 
Oracle api gateway installation as cluster and single node
Osama Mustafa
 
Helping implementer dealing with famous siebel based system messages and er...
Osama Mustafa
 
Weblogic and docker
Osama Mustafa
 
Weblogic 101 for dba
Osama Mustafa
 
Oracle Enterprise manager 13c Installation
Osama Mustafa
 
Eouc 12 on 12c osama mustafa
Osama Mustafa
 
Enable oracle database vault
Osama Mustafa
 
12c on RHEL7
Osama Mustafa
 
Weblogic 12c installation (oracle linux)
Osama Mustafa
 

Recently uploaded (20)

PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Digital Circuits, important subject in CS
contactparinay1
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 

Oracle to MySQL DatabaseLink

  • 1. DATABASE LINK FROM ORACLE TO MYSQL Introduction This document describe steps to create database link between oracle to MySQL (Heterogeneous Services) / Oracle Gateway, Regarding to Oracle Documentation Gateways will integrate with any number of non-Oracle systems from an Oracle application. Environment:- Operating System: Solaris 11.1 Database: - 11.2.0.3 In my case Grid Infrastructure installed on both node, so I choose one node to configure database link. Software Needed:- 1- UnixODBC (Generic), Download From here. 2- MySQL ODBC/Connector, Download From Here. Notes:- Command Line will be in Red Color. Output for command Line will be in Blue Color.
  • 2. DATABASE LINK FROM ORACLE TO MYSQL About the Author Osama Mustafa has progressive experience in Oracle Products, community. He recently served as Oracle Database Administrator. Provide Database Implementation Solutions, High Availability Solution, Infrastructure and Storage Planning, Install, Configure, Implement and manage Oracle E-Business Suite environments. Architect, build and support highly-available Oracle EBS, Database and Fusion Middleware environments including appropriate reporting, Installs, configures, upgrades, tunes, and maintains production, development and test databases. He entered Oracle ACE Program in 2013, he is author for the book Oracle Penetration Testing, Osama Mustafa Certified OCP 10g,11g, Linux Implementations , Certified Ethical hacker and LPT , and Solaris Administrator. Include to all this Osama Mustafa is international Speaker in Oracle User Group and Oracle OTN Tour, Published Online Articles in His blog about Oracle Technology. Twitter: @OsamaOracle G+: Osama Mustafa SlidShare: Osama Mustafa LinkedIn: http://www.linkedin.com/in/osamamustafa Blog: https://osamamustafa.blogpsot.com.
  • 3. DATABASE LINK FROM ORACLE TO MYSQL To start Configure Database Link you need to follow the below steps first, to make easier I already upload the necessary files you will need on my account here: - https://github.com/OsamaOracle/db4odbc.git You Can Download it and Change Path depend on files and Library Locations, You can create your entire in Listener.ora and Tnsnames.ora but Sometimes problem related to space and “(“ “)” will show up. Step #1:- Determine Version for dg4odbc on Operating system using file $ORACLE_HOME/bin/dg4odbc ELF 64-bit LSB executable, Intel x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped This Command Explain which version of ODBC Driver I should use Which 64 bit. Step #2:- (This step should be done as root user). It’s Time to Download and Install unixODBC, I will assume you already download the file and upload to the server, I am using Solaris 11.2 but as I already mentioned before I will build unixODBC manually therefore I will not use unixODBC.pkg. In the website http://unixODBC.org they already mentioned step to configure it but I will re mention it here again. I prefer to setup and configure unixODBC under /usr/local/unixODBC. Installation Steps:- # unzip unixODBC.
  • 4. DATABASE LINK FROM ORACLE TO MYSQL # cd UnixODBC. # export CFLAGS="-m64" # ./configure --prefix=/usr/local/unixODBC # make # make install Step #3:- (As Oracle User). Now unixODBC installed and configured under /usr/local/unixODBC, Next Step Download MySQL ODBC Connecter, Choose the right one for your OS depend on MySQL Version. Upload connector to the server and unzip it only (without do anything else) under /u01/app/oracle/. Step #4:- (As Oracle User). Export Variables. In Linux  .bash_profile In Solairs  .profile First Variable:- export LD_LIBRARY_PATH= /u01/app/oracle/product/11.2.0/db_home1/lib32:/usr/local/unixODBC/lib/:/u01/app/oracle/mysql- connector-odbc-5.1.6-solaris11-x86-32bit/lib/libmyodbc5.so Second Variable:- export ODBCINI=/usr/local/unixODBC/etc/odbc.ini export ODBCSYSINI= /usr/local/unixODBC/etc This step is very important and without will cause problem with Library.
  • 5. DATABASE LINK FROM ORACLE TO MYSQL Step #5:- ( As Root User ). Configure odbc.ini located in ( /usr/local/unixODBC/etc ), the file should look like the below :- [DSN-NAME] Driver = /u01/app/oracle/mysql-connector-odbc-3.51.30-solaris10-sparc-64bit/lib/libmyodbc3.so DATABASE = <MySQL-Database-name> DESCRIPTION = MySQL ODBC 5.2.5 Connector Sample PORT =<listing Port for MySQL> Default 3306 SERVER = < MySQL Server IP > UID= username PWD = password (should be complex). Option=3 Examples:- [MySQL] Driver = /u01/app/oracle/mysql-connector-odbc-3.51.30-solaris10-sparc- 64bit/lib/libmyodbc3.so DATABASE = 4s DESCRIPTION = MySQL ODBC 5.2.5 Connector Sample PORT = 3306 SERVER = 172.16.2.120 UID= root PWD = Osama123 Option=3 It’s configured.
  • 6. DATABASE LINK FROM ORACLE TO MYSQL Step #6:- I choose to put this as steps because it will avoid time wasting which library test. As Oracle User:- # ldd libmyodbc3.so The output will be like:- libsocket.so.1 => /lib/64/libsocket.so.1 libnsl.so.1 => /lib/64/libnsl.so.1 libm.so.2 => /lib/64/libm.so.2 librt.so.1 => /lib/64/librt.so.1 libz.so.1 => /lib/64/libz.so.1 libodbcinst.so.1 => /usr/lib/64/libodbcinst.so.1 libdl.so.1 => /lib/64/libdl.so.1 libthread.so.1 => /lib/64/libthread.so.1 libc.so.1 => /lib/64/libc.so.1 libmp.so.2 => /lib/64/libmp.so.2 libmd.so.1 => /lib/64/libmd.so.1 libltdl.so.7 => /usr/lib/64/libltdl.so.7 libpthread.so.1 => /lib/64/libpthread.so.1 libcryptoutil.so.1 => /lib/64/libcryptoutil.so.1 /lib/sparcv9/../libm/sparcv9/libm_hwcap1.so.2 The Most Important thing in the above output to check if there is nothing in library “Not Found” Step #7:- (As oracle User).
  • 7. DATABASE LINK FROM ORACLE TO MYSQL Test connection using odbc only, Only on OS Level, go the /usr/local/unixODBC/bin. # ./isql –v [DSN-NAME] Example:- # ./isql –v MySQL. The below is output:- +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+ SQL> Until this step you didn’t do anything only configure odbc, next step will explain how to configure Oracle. Step #8:-
  • 8. DATABASE LINK FROM ORACLE TO MYSQL Configuration for Oracle Start with initSID.ora file. Oracle already create template located in $ORACLE_HOME/hs/admin just copy with new name, the default one initdg4odbc.ora you can leave without change and edit it. Edit the file and set the new variables like the below:- # #HS init parameters # HS_FDS_CONNECT_INFO= [DSN_NAME]  same as odbc.ini HS_FDS_TRACE_LEVEL= DEBUG  Trace level. HS_FDS_SHAREABLE_NAME= /usr/local/unixODBC/lib/libodbc.so HS_FDS_SUPPORT_STATISTICS= FALSE HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P1 #HS_NLS_DATE_FORMAT=YYYY-MM-DD # # ODBC specific environment variables # set ODBCINI=/usr/local/unixODBC/etc/odbc.ini Example:- # #HS init parameters # HS_FDS_CONNECT_INFO= MySQL HS_FDS_TRACE_LEVEL= off HS_FDS_SHAREABLE_NAME= /usr/local/unixODBC/lib/libodbc.so HS_FDS_SUPPORT_STATISTICS= FALSE HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P1 #HS_NLS_DATE_FORMAT=YYYY-MM-DD # # ODBC specific environment variables # set ODBCINI=/usr/local/unixODBC/etc/odbc.ini Step #9:
  • 9. DATABASE LINK FROM ORACLE TO MYSQL This Step will describe how to configure Listener.ora, You can download Listener.ora and copy/Paste the entire to make sure there’s nothing wrong or you can create your own. Open Listener.ora and add the below line depend on your Configuration :- SID_LIST_LISTENER= (SID_LIST= (SID_DESC= (SID_NAME=dg4odbc) (ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_home1) (ENVS=LD_LIBRARY_PATH=/usr/local/unixODBC/lib:/u01/app/oracle/product/11.2.0/db_home1 /lib:/u01/app/oracle/mysql-connector-odbc-3.51.30-solaris10-sparc-64bit/lib) (PROGRAM=dg4odbc) ) ) Some Notes about the above:- 1- SID_LIST_LISTENER  Indicate to your LISTENER NAME. 2- SID_NAME= Depend init….ora file. 3- Change ORACLE_HOME. 4- LD_LIBRARY_PATH Depend where you installed unixODBC and MySQL connecter. 5- Program Indicate to init…ora name. Now After edit Listener.ora Save it, this step require to restart Listener.ora LSNRCTL > stop LISTENER LSNRCTL > Start LISTENER Output:-
  • 10. DATABASE LINK FROM ORACLE TO MYSQL Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Solaris: Version 11.2.0.3.0 - Production Start Date 16-JUN-2014 15:51:47 Uptime 0 days 1 hr. 50 min. 11 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora Listener Log File /u01/app/grid/diag/tnslsnr/Node1/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Node1)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Node2)(PORT=1521))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "PRDSBL" has 1 instance(s). Instance "PRDSBL1", status READY, has 1 handler(s) for this service... Service "PRDSBLXDB" has 1 instance(s). Instance "PRDSBL1", status READY, has 1 handler(s) for this service... Service "dg4odbc" has 1 instance(s). Instance "dg4odbc", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully Step #10:- Finally add new entire to tnsnames.ora dg4odbc = (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=sbl-prd-db1)(PORT=1521)) (CONNECT_DATA=(SID=dg4odbc)) (HS=OK) ) tnsping dg4odbc should work. Step #11:-
  • 11. DATABASE LINK FROM ORACLE TO MYSQL SQL > create public database link <DB-LINK-NAME> connect "usename" identified by "password" using 'odbc'; Notes: 1- Username & password should be the same as odbc.ini ( in my case root and Osama123); 2- Tnsnames.ora should be the same as entire in tnsnames.ora. Now Test it :- SQL > Select * from “Table-name”@DB-Link Reference:-  How to Resolve Common Errors Encountered while using Database Gateways (DG4IFMX, Dg4MSQL, DG4SYBS), DG4ODBC or Generic Connectivity (Doc ID 234517.1)  Database Gateway and Generic Connectivity (DG4ODBC) Licensing Considerations (Doc ID 232482.1)  Gateway Configuration Utility for Database Gateway for ODBC - DG4ODBC - to Connect to Non- Oracle Databases For Example - DB2, SQL*Server, Sybase, Informix, MySQL (Doc ID 1274143.1)  Master Note for Oracle Gateway Products (Doc ID 1083703.1)  What Are The Options To Connect From Oracle Via a Database Link Using DG4ODBC To MySQL Using An ODBC Driver? (Doc ID 1526864.1) Thank you Osama Mustafa Oracle ACE.