agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
[Pljava-dev] Calling Java from Postgresql Function
3+ messages / 0 participants
[nested] [flat]

* [Pljava-dev] Calling Java from Postgresql Function
@ 2012-04-10 12:26  
  0 siblings, 1 reply; 3+ messages in thread

From:  @ 2012-04-10 12:26 UTC (permalink / raw)

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.




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* [Pljava-dev] Calling Java from Postgresql Function
@ 2012-04-10 18:22  
  parent: 
  0 siblings, 1 reply; 3+ messages in thread

From:  @ 2012-04-10 18:22 UTC (permalink / raw)

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





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* [Pljava-dev] Calling Java from Postgresql Function
@ 2012-04-12 13:13  
  parent: 
  0 siblings, 0 replies; 3+ messages in thread

From:  @ 2012-04-12 13:13 UTC (permalink / raw)

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/




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2012-04-12 13:13 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-04-10 12:26 [Pljava-dev] Calling Java from Postgresql Function 
2012-04-10 18:22 ` 
2012-04-12 13:13   ` 

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox