[Pljava-dev] Calling Java from Postgresql Function

Lists: pljava-dev
From: murthy516(dot)siet at gmail(dot)com (murthy516)
To:
Subject: [Pljava-dev] Calling Java from Postgresql Function
Date: 2012-04-10 12:26:14
Message-ID: 1334060774007-5629757.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: PostgreSQL : PostgreSQL 메일 링리스트 : 2012-04-10 12:26 이후 토토 사이트 순위.

Hi,

I'm new to postgresql.Can anyone please suggest me how to write a stored
procedure in Postgresql that makes call to Java method.

If I make call to Java method,how to set classpath for that Java(.class
file) in postgresql.Please suggest me

Thanks
Krrish

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Calling-Java-from-Postgresql-Function-tp5629757p5629757.html
Sent from the PL/Java mailing list archive at Nabble.com.


From: pierce at hogranch(dot)com (John R Pierce)
To:
Subject: [Pljava-dev] Calling Java from Postgresql Function
Date: 2012-04-10 18:22:41
Message-ID: 4F847A71.60808@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pljava-dev

On 04/10/12 5:26 AM, murthy516 wrote:
> I'm new to postgresql.Can anyone please suggest me how to write a stored
> procedure in Postgresql that makes call to Java method.
>
> If I make call to Java method,how to set classpath for that Java(.class
> file) in postgresql.Please suggest me

you need pljava for this.
http://wiki.tada.se/index.php?title=Main_Page

the classpath can be set via the deployer, or via a SQL function call.

--
john r pierce N 37, W 122
santa cruz ca mid-left coast


From: johann at 2ndquadrant(dot)com (Johann 'Myrkraverk' Oskarsson)
To:
Subject: [Pljava-dev] Calling Java from Postgresql Function
Date: 2012-04-12 13:13:10
Message-ID: qb2mmu.x5qb2mmu.k41l.hz4p.gnus@asuka.myrkraverk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pljava-dev

Hi,

John R Pierce <pierce at hogranch.com> writes:

> On 04/10/12 5:26 AM, murthy516 wrote:
>> I'm new to postgresql.Can anyone please suggest me how to write a
>> stored procedure in Postgresql that makes call to Java method.
>>
>> If I make call to Java method,how to set classpath for that
>> Java(.class file) in postgresql.Please suggest me
>
> you need pljava for this.
> http://wiki.tada.se/index.php?title=Main_Page
>
> the classpath can be set via the deployer, or via a SQL function call.

A typical process for this is:

* Compile and wrap your java code into a jar file.

* Place the jar somewhere the PostgreSQL server can see it in the
(server's) file system.

* Run SELECT sqlj.install_jar( 'file:///full/path/to/file.jar',
'JarNameInTheDatabase',
false ); -- Unless you include SQL
-- statements in the jar file as
-- per the SQL JRT standard,
-- then it's true.

* Run SELECT sqlj.set_classpath( 'SchemaName',
'JarNameInTheDatabase' );

Now you can call the functions in the schema "SchemaName", which is
usually "public".

--
Johann Oskarsson http://www.2ndquadrant.com/ |[]
PostgreSQL Development, 24x7 Support, Training and Services --+--
|
Blog: http://my.opera.com/myrkraverk/blog/