Connecting Oracle to Amazon Aurora
You can use an Easysoft ODBC driver to connect Oracle to MySQL or PostgreSQL running on Amazon Aurora. The steps in this guide are for MySQL and Oracle on Windows. The process is the same for PostgreSQL and other Oracle platforms.
Installing the MySQL ODBC Driver
- Download the MySQL ODBC driver for Windows. (Registration required.)
- Install and license the MySQL ODBC driver on the machine where Oracle is installed.
To do this, execute the file distribution that you downloaded in the previous step, and follow the on screen instructions.
The install program starts the Easysoft License Manager, because you cannot use the MySQL ODBC Driver until a license is obtained.
The following types of license are available:
- Free time-limited trial license which gives you free and unrestricted use of the product for a limited period (usually 14 days).
- Full license if you have purchased the product. On purchasing the product you are given an authorization code, which you use to obtain a license
- In Easysoft License Manager, enter your details.
You MUST enter the Name, E-Mail Address and Company fields.
The E-Mail Address MUST be the same as the address used to register and download from the Easysoft web site or you will be unable to obtain trial licenses.
- Choose Request License.
You are asked for a license type.
- Do one of the following:
- For a trial license click Time Limited Trial and then click Next.
The License Manager asks what software you are licensing. Select Easysoft MySQL ODBC Driver from the drop-down list and then click Next.
- If you have obtained an authorization code for a purchased license, select Non-expiring License and then click Next.
The License Manager requests your authorization code.
Enter the authorization code and then click Next.
- For a trial license click Time Limited Trial and then click Next.
- The License Manager displays a summary of the information you entered and allows you to choose the method of applying for your license.
- Do one of the following:
- Choose On-line Request if your machine is connected to the internet and can make outgoing connections to port 8884.
The License Manager then sends a request to the Easysoft license server to activate your license key automatically. This is the quickest method and results in your details being entered immediately into our support database.
- The remaining three options (Email Request, Print Request and View Request) are all ways to obtain a license if your machine is off-line (i.e. does not have a connection to the internet).
Each of these methods involves providing Easysoft with information including your machine number (a number unique to your machine) and then waiting to receive your license key.
Instead of emailing your details to Easysoft, you can enter them directly at the Easysoft web site and your license key will be emailed to you automatically.
To use this method, click View Request, and then visit:
In the Licensing page, enter your machine number (and authorization code for purchased license), click Submit and your license key will be emailed to you.
When you receive the license key, you can activate it either by double-clicking the email attachment or by clicking Enter License on the License Manager main screen and pasting the license key into the dialog box.
- Choose Finish to exit the License Manager.
The installation is complete.
- Choose On-line Request if your machine is connected to the internet and can make outgoing connections to port 8884.
Configuring an ODBC Data Source
Before you can use the MySQL ODBC Driver to connect Oracle to MySQL, you need to configure an ODBC data source. An ODBC data source stores the connection details for the target database (e.g. MySQL) and the ODBC driver that is required to connect to it (e.g. the MySQL ODBC driver).
You configure ODBC data sources in ODBC Administrator, which is included with Windows. How you run ODBC Administrator depends on whether your version of Windows is 32-bit or 64-bit:
-
I have 32-bit Windows
To run ODBC Administrator on 32-bit Windows, open Administrative Tools in Control Panel, and then open Data Sources (ODBC). (On older versions of Windows, the Control Panel applet that launches ODBC Administrator is labelled Data Sources.)
-
I have 64-bit Windows
There are two versions of ODBC Administrator on this platform. The version of ODBC Administrator that you need to run depends on whether the application you want to connect to MySQL is 32-bit or 64-bit. For the applications covered in this article, refer to the following table to find out the application's architecture.
If you have a 64-bit application, you need to run 64-bit version of ODBC Administrator. To do this, open Administrative Tools in Control Panel, and then open Data Sources (ODBC). (On Windows Server 2003 and earlier, the Control Panel applet that launches ODBC Administrator is labelled Data Sources. On Windows 8 and later, the Control Panel applet is labelled ODBC Data Sources (64-bit).)
If you have a 32-bit application, you need to run 32-bit version of ODBC Administrator. To do this, in the Windows Run dialog box, type:
%windir%\syswow64\odbcad32.exe
-
I'm not sure whether I have 32-bit or 64-bit Windows
If you are not sure whether your version of Windows is 32-bit or 64-bit, follow the instructions in this Microsoft Knowledge Base article to find out.
Use ODBC Administrator to create a MySQL ODBC Driver data source:
- Choose the System DSN tab, and then choose Add.
- In the Create New Data Source dialog box, choose Easysoft ODBC-MySQL Driver, and then choose Finish.
- Complete these fields Easysoft ODBC-MySQL Driver DSN Setup dialog box:
Setting Value DSN MYSQL User Name The name of your MySQL user. Password The password for your MySQL user. Server The host name or IP address of the machine on which your MySQL server is running. For example: mynode.eu-west-2.rds.amazonaws.com
SSL Encryption Enabled Trust Cert Enabled - Use the Test button to verify that you can successfully connect to your MySQL database.
Connecting Oracle to MySQL
The following instructions show you how to connect Oracle® on Windows to MySQL on Aurora. For further information about DG4ODBC, refer to our DG4ODBC for Windows tutorial.
- Create a DG4ODBC init file. To do this, change to the
%ORACLE_HOME%\hs\admin
directory. Create a copy of the fileinitdg4odbc.ora
. Name the new fileinitmysql.ora
.Note In these instructions, replace %ORACLE_HOME% with the location of your Oracle® HOME directory. For example,
C:\oraclexe\app\oracle\product\11.2.0\server
. - Ensure these parameters and values are present in your init file:
HS_FDS_CONNECT_INFO = my_mysql_odbc_dsn
Replace my_mysql_odbc_dsn with the name of a MySQL ODBC driver data source that connects to the target MySQL server. For example
HS_FDS_CONNECT_INFO = "32-bit MySQL System"
If your MySQL server does not require you to supply a user name and a password, include
IgnoreAuth=Yes
in theHS_FDS_CONNECT_INFO
parameter value. For example:HS_FDS_CONNECT_INFO = "32-bit MySQL System;IgnoreAuth=Yes"
- Add this line to increase Oracle® / MySQL compatibility:
HS_FDS_QUOTE_IDENTIFIER = FALSE
- Comment out the line that enables DG4ODBC tracing. For example:
#HS_FDS_TRACE_LEVEL = <trace_level>
- Add an entry to
%ORACLE_HOME%\network\admin\listener.ora
that creates a SID_NAME for DG4ODBC. For example:SID_LIST_LISTENER = (SID_LIST = (SID_DESC= (SID_NAME=mysql) (ORACLE_HOME=%ORACLE_HOME%) (PROGRAM=dg4odbc) ) )
- Add a DG4ODBC entry to
%ORACLE_HOME%\network\admin\tnsnames.ora
that specifies the SID_NAME created in the previous step. For example:MYSQL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oracle_host)(PORT = 1521)) (CONNECT_DATA = (SID = mysql) ) (HS = OK) )
Replace oracle_host with the host name of your Oracle® machine.
- Start (or restart) the Oracle® Listener:
cd %ORACLE_HOME%\bin lsnrctl stop lsnrctl start
- Connect to your Oracle® database in SQL*Plus.
- In SQL*Plus, create a database link for the target MySQL server. For example:
CREATE PUBLIC DATABASE LINK mysqllink CONNECT TO "my_mysql_user" IDENTIFIED by "my_mysql_password" USING 'mysql';
– Or, if your MySQL server does not require you to supply a user name and a password:
CREATE PUBLIC DATABASE LINK mysqllink USING 'mysql';
Notes
- If you have problems connecting to MySQL from Oracle®, enable DG4ODBC tracing and check the trace files written to the
%ORACLE_HOME%\hs\trace
directory. To enable DG4ODBC tracing, add the lineHS_FDS_TRACE_LEVEL = DEBUG
toinitmysql.ora
and then start / restart the Oracle® listener. If thetrace
directory does not exist, create it. - If you enable ODBC Driver Manager tracing, but do not get a trace file or get an empty trace file, change the trace file location to the Windows TEMP directory. For example,
C:\Windows\Temp\SQL.log
.