Re: Calling oracle function from PostgreSQL

From: TIM CHILD <tim(dot)child(at)comcast(dot)net>
To: Shweta Rahate <rahateshweta20(at)gmail(dot)com>, "pgsql-novice(at)lists(dot)postgresql(dot)org" <pgsql-novice(at)lists(dot)postgresql(dot)org>
Subject: Re: Calling oracle function from PostgreSQL
Date: 2024-08-30 23:12:10
Message-ID: 879742875.262037.1725059530818@connect.xfinity.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Shweta,

Another approach is to write a Postgres UDF (User Defined Function) written in JavaScript using the PLV8 add-on. https://github.com/plv8/plv8 https://github.com/plv8/plv8
You can then write a simple JavaScript function that connects to the Oracle database and calls your Oracle function return that result to your Postgres UDF.

Most Cloud providers support the installation of PLV8. You'll need ensure firewall and network rules allow outbound and inbound connections between the PostgreSQL server and the Oracle server. For additional security you should create a special Oracle user with very restricted privileges, to only execute that function, and use that user in the JavaScript function when you connect to Oracle. You'll also need to take care to not include the Oracle user name and password in your JavaScript code.. You'll have to master the esbuild https://esbuild.github.io/ JavaScript bundler to include the Oracle JavaScript packages and dependencies.

This approach won't be efficient as you be establishing a new Oracle connection every time you call it from PostgreSQL.

-Tim





> On 08/30/2024 12:08 AM PDT Shweta Rahate <rahateshweta20(at)gmail(dot)com> wrote:
>
>
> Hi All,
>
> In my application there is a requirement to call the oracle function from PostgreSQL db.
>
> The oracle function should take the input from Postgres db and returns the output.
> Please suggest a way to achieve this.
>
>
>
> Regards,
> Shweta
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Laurenz Albe 2024-09-02 11:30:00 Re: Calling oracle function from PostgreSQL
Previous Message Kashif Zeeshan 2024-08-30 16:48:27 Re: Calling oracle function from PostgreSQL