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 |
Thread: | |
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/
From | Date | Subject | |
---|---|---|---|
Next Message | Johann 'Myrkraverk' Oskarsson | 2012-04-13 21:06:59 | [Pljava-dev] Multidimensional array support in resultset.updateObject() |
Previous Message | Johann 'Myrkraverk' Oskarsson | 2012-04-12 13:04:33 | [Pljava-dev] Building and testing on MacOS X |