An organization have lot of choices to choose from the RDBMS world. Oracle Database, Microsoft SQL Server, IBM DB2,PostgreSQL, MySQL are few of them. Most of the organizations out there do have a mix of all these which are used to store their data and in course of time it is inevitable that they would want to transfer data from ‘this database’ to ‘that database’. Oracle, the uncrowned king of this RDBMS world call this “Heterogeneous Connectivity” and have incorporated this facility into their database and this is installed by default.

Oracle does not provide the ODBC driver for PostgreSQL, it should be acquired from third party. I downloaded the psqlOBDC driver from .

The steps are:

  • Install Oracle Transparent Gateway for PostgreSQL
  • Create the ODBC data source
  • Configure the gateway initialization parameter file
  • Configure the listener
  • Configure the Oracle database tnsnames.ora
  • Creating DB link from Oracle database to PostGresSQL Server

Step 1 :

Create System DSN for PostgreSQL :

Go to Control Panel > Administrative Tools > ODBC Data Sources

Select PostgresSQL odbc driver and Click on Add Button

Click On Finish

Enter the ODBC Datasource name ( i gave PostgreSQL), Server Name (put the IP address of PostgreSQL DB server), Database Name (PostgreSQL DB name) and User Name (PostgreSQL userid) and password.
Now we have an ODBC Data Source called “PostgreSQL”.

Step 2 :
Now go to cd $ORACLE_HOME\hs\admin\
Update following lines to initdg4odbc.ora file :

Step 3 :
Add following lines to listener.ora file :

Step 4 : Restart listener

Step 5 :Check listener status

Append following lines to TNSNAMES.ora file :

Check tnsping :

Create a Database link using above mentioned tnsname entry and PostgreSQL Credential :

Now fetch data using Database Link :

In next article we can configure Oracle Database Gateway for MySQL.

Thank you for giving your valuable time to read the above information.

If you want to be updated with all our articles send us the Invitation or Follow us:

Skant Gupta’s LinkedIn:

Joel Perez’s LinkedIn:

Anuradha’s LinkedIn: Anuradha’s Profile

LinkedIn Group: Oracle Cloud DBAAS

Facebook Page: OracleHelp

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.