Amazon RDS for Oracle databases need to connect to external data sources, such as RDS for PostgreSQL. PostgreSQL can establish connections to Oracle databases using a foreign data wrapper (FDW). However, when connecting from RDS for Oracle to PostgreSQL, you need an Oracle Database Gateway for ODBC (DG4ODBC) installed on a separate server. In this post, we walk you through setting up an EC2 instance as a database gateway server.
For RDS for Oracle databases to connect to external data sources, you need to install Oracle Database Gateway on an EC2 instance along with the required ODBC drivers.
The following diagram provides an overview of the solution. In RDS for Oracle, when a user needs to access data from RDS for PostgreSQL, the solution uses a database link pointing to Oracle Database Gateway for ODBC (DG4ODBC), which uses ODBC drivers and PostgreSQL client libraries to connect to RDS for PostgreSQL and retrieves the data.
Create an EC2 instance with Linux x86-64 OS, which will be used to install and run Oracle Database Gateway for ODBC.
Make sure the EC2 instance meets the minimum hardware and software requirements to run Oracle Database Gateway for ODBC.
Update the Oracle Database Gateway for ODBC EC2 instance’s security group to allow inbound traffic from the RDS for Oracle instance.
Update the RDS for PostgreSQL security group to allow inbound traffic from the Oracle Database Gateway for ODBC EC2 instance.
Prepare wget.sh script to download the Oracle Database Gateway software.
Install the required packages and unzip the install file.
Install the Unix ODBC Driver Manager and the latest PostgreSQL client, libraries and ODBC drivers.