on linux
1. install ODBS drivers
yum install unixODBC
yum install mysql-connector-odbc
2. check if driver is in /etc/odbcinst.ini
# Driver from the mysql-connector-odbc package
# Setup from the unixODBC-libs package
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc3_r.so
Setup = /usr/lib/libodbcmyS.so
Driver64 = /usr/lib64/libmyodbc3_r.so
Setup64 = /usr/lib64/libodbcmyS.so
FileUsage = 1
1. install ODBS drivers
yum install unixODBC
yum install mysql-connector-odbc
2. check if driver is in /etc/odbcinst.ini
# Driver from the mysql-connector-odbc package
# Setup from the unixODBC-libs package
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc3_r.so
Setup = /usr/lib/libodbcmyS.so
Driver64 = /usr/lib64/libmyodbc3_r.so
Setup64 = /usr/lib64/libodbcmyS.so
FileUsage = 1
3. add entry into /etc/odbc.ini
[MySQL]
Description = MySQL test database
Trace = Off
TraceFile = stderr
Driver = MySQL
SERVER = 192.168.x.x
USER = root
PASSWORD = *******
PORT = 3306
DATABASE = test
4. test ODBC connection
$ isql -v MySQL
5. configure Oracle heterogeneous service
$ cp /u01/app/oracle/product/11.2.0/db_1/hs/admin/initdg4odbc.ora /u01/app/oracle/product/11.2.0/db_1/hs/admin/initMySQL.ora
6. edit /u01/app/oracle/product/11.2.0/db_1/hs/admin/initMySQL.ora
$ cat ../../hs/admin/initMySQL.ora | grep -v ^"#"
HS_FDS_CONNECT_INFO = MySQL
HS_FDS_TRACE_LEVEL = OFF
HS_FDS_SHAREABLE_NAME = /usr/lib/libodbc.so
HS_LANGUAGE=american_america.we8mswin1252
set ODBCINI=/etc/odbc.ini
7. configure listener
/u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
SID_LIST_LISTENER=
...
(SID_DESC=
(SID_NAME=MySQL)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
(PROGRAM=dg4odbc)
)
...
)
...
restart listener
8. add entry into /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
...
mysql =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))
(CONNECT_DATA=(SID=MySQL))
(HS=OK)
)
...
9. connect into DB and create database link
SQL> create public database link MY_MYSQL connect to "root" identified by "*******" using 'mysql';
10. test select
SQL> select * from table1@my_mysql;