step
1. Download and installation [the ODBC Driver Manager]
2. downloaded and installed [the MySQL Connector / the ODBC Driver]
3. Configure the odbc.ini
4. configure the environment variables
5. Configure the tnsnames.ora
6. The Configure the listener.ora
7. The configuration of the monitor initialization file
8. create dblink
1. Download and installation [ODBC Driver Manager]
# Create a directory to place the driver package for environment
[oracle@oracle169 ~]$ cd $ORACLE_BASE [oracle@oracle169 app]$ mkdir tools [oracle@oracle169 app]$ cd tools
# Download and install unixODBC-2.2.14-linux-x86-64.tar.gz; and upload to the tools directory. And extract
# Download https://sourceforge.net/projects/unixodbc/files/?source=navbar
[oracle@oracle169 tools]$ tar -zxvf unixODBC-2.2.14-linux-x86-64.tar.gz [oracle@oracle169 tools]$ mkdir unixodbc-2.2.14 [oracle@oracle169 tools]$ mv usr/local/* unixodbc-2.2.14/ [oracle@oracle169 tools]$ rm -rf usr/
2. Download and install [MySQL Connector / ODBC driver]
# Unzip download the corresponding version of mysql-connector-odbc-5.3.7- linux-el6-x86-64bit.tar.gz; this environment is linux 6.5
Download https://dev.mysql.com/downloads/connector/odbc /
[oracle@oracle169 tools]$ tar -zxvf mysql-connector-odbc-5.3.7-linux-el6-x86-64bit.tar.gz [oracle@oracle169 tools]$ mv mysql-connector-odbc-5.3.7-linux-el6-x86-64bit my5
3. Configure odbc.ini;
[ The Oracle @ oracle169 Tools ] $ vim the odbc.ini [ testdb ] Driver = / u01 / App / Tools / MY5 / lib / libmyodbc5a.so SERVER = #mysql server ip PORT = #mysql database port the USER = #mysql database user name PASSWORD = #mysql database password dATABASE = #mysql database OPTION = 3 SOCKET =
4. Configure Environment Variables
Add the following in the back .bash_profile
export PATH=/u01/app/tools/unixODBC-2.2.14/bin:$PATH export LD_LIBRARY_PATH=/u01/app/tools/unixODBC-2.2.14/lib:$LD_LIBRARY_PATH export ODBCINI=/u01/app/tools/odbc.ini
After the source .bash_profile; this time to test the above configuration is correct
implementation of isql -v testdb
If there is this; represents the above configuration is OK.
+---------------------------------------+
| Connected! |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
5. Configuration tnsnames.ora
Add later
testdb = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SID = testdb)) (HS=OK) ) )
6. Configure listener.ora
# Join the red part; and restart the listener
SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = testdb) (ORACLE_HOME =/u01/app/oracle) (PROGRAM = dg4odbc) (ENVS=LD_LIBRARY_PATH=/u01/app/tools/unixODBC-2.2.14/lib) ) )
7. Configure the monitor's initialization file
[oracle@oracle169 tools]$ vim $ORACLE_HOME/hs/admin/inittestdb.ora # 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 = testdb HS_FDS_FETCH_ROWS=100 HS_RPC_FETCH_SIZE=50000 HS_FDS_TRACE_LEVEL = off HS_FDS_SHAREABLE_NAME = /u01/app/tools/unixODBC-2.2.14/lib/libodbc.so HS_LANGUAGE=american_america.we8iso8859p1 HS_NLS_NCHAR=UCS2 # # ODBC specific environment variables # set ODBCINI= /u01/app/tools/odbc.ini # # Environment variables required for the non-Oracle system # #set <envvar>=<value>
8. Create dblink
create public database link db_testdb connect to "mysql_user" identified by "password" using 'testdb';