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
Get to know PostgreSQL!
Oddbjørn Steffensen
 
PDF
Understanding oracle rac internals part 2 - slides
Mohamed Farouk
 
PDF
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법
Ji-Woong Choi
 
PPTX
MySQL8.0_performance_schema.pptx
NeoClova
 
PPTX
Oracle Database in-Memory Overivew
Maria Colgan
 
PDF
MariaDB 10.5 binary install (바이너리 설치)
NeoClova
 
PPTX
Why oracle data guard new features in oracle 18c, 19c
Satishbabu Gunukula
 
PPTX
Automating Your Clone in E-Business Suite R12.2
Michael Brown
 
DOCX
Backup and Restore of database on 2-Node RAC
Paulo Fagundes
 
DOCX
Keepalived+MaxScale+MariaDB_운영매뉴얼_1.0.docx
NeoClova
 
PDF
Maxscale_메뉴얼
NeoClova
 
PDF
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 1
Tanel Poder
 
PDF
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Jean-François Gagné
 
PDF
[Pgday.Seoul 2020] SQL Tuning
PgDay.Seoul
 
PPTX
Query logging with proxysql
YoungHeon (Roy) Kim
 
PDF
MySQL 상태 메시지 분석 및 활용
I Goo Lee
 
PDF
Weblogic 12c installation (oracle linux)
Osama Mustafa
 
PDF
MySQL Administrator 2021 - 네오클로바
NeoClova
 
PDF
How to Manage Scale-Out Environments with MariaDB MaxScale
MariaDB plc
 
PDF
MongoDB Cheat Sheet – Quick Reference
César Trigo
 
Get to know PostgreSQL!
Oddbjørn Steffensen
 
Understanding oracle rac internals part 2 - slides
Mohamed Farouk
 
[오픈소스컨설팅]Day #1 MySQL 엔진소개, 튜닝, 백업 및 복구, 업그레이드방법
Ji-Woong Choi
 
MySQL8.0_performance_schema.pptx
NeoClova
 
Oracle Database in-Memory Overivew
Maria Colgan
 
MariaDB 10.5 binary install (바이너리 설치)
NeoClova
 
Why oracle data guard new features in oracle 18c, 19c
Satishbabu Gunukula
 
Automating Your Clone in E-Business Suite R12.2
Michael Brown
 
Backup and Restore of database on 2-Node RAC
Paulo Fagundes
 
Keepalived+MaxScale+MariaDB_운영매뉴얼_1.0.docx
NeoClova
 
Maxscale_메뉴얼
NeoClova
 
Tanel Poder - Troubleshooting Complex Oracle Performance Issues - Part 1
Tanel Poder
 
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Jean-François Gagné
 
[Pgday.Seoul 2020] SQL Tuning
PgDay.Seoul
 
Query logging with proxysql
YoungHeon (Roy) Kim
 
MySQL 상태 메시지 분석 및 활용
I Goo Lee
 
Weblogic 12c installation (oracle linux)
Osama Mustafa
 
MySQL Administrator 2021 - 네오클로바
NeoClova
 
How to Manage Scale-Out Environments with MariaDB MaxScale
MariaDB plc
 
MongoDB Cheat Sheet – Quick Reference
César Trigo
 

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 (16)

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
 
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
 

Recently uploaded (20)

PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 

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.