X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B26D5329E3B for ; Thu, 30 Sep 2004 14:29:07 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89722-04 for ; Thu, 30 Sep 2004 13:29:02 +0000 (GMT) Received: from barolo.k2defender.com (barolo.k2defender.com [195.212.0.43]) by svr1.postgresql.org (Postfix) with ESMTP id DAD6332A344 for ; Thu, 30 Sep 2004 14:29:03 +0100 (BST) Received: from [192.168.51.85] (garnet.albourne.com [213.207.142.99]) by barolo.k2defender.com (8.12.1/8.12.1/K2Defender/1.12/BL/TLS) with ESMTP id i8UDSm2f006610 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=OK); Thu, 30 Sep 2004 14:28:53 +0100 (BST) Message-ID: <415C09F4.2090506@albourne.com> Date: Thu, 30 Sep 2004 16:28:20 +0300 From: Adriaan Joubert User-Agent: Mozilla Thunderbird 0.8 (X11/20040926) X-Accept-Language: en-gb MIME-Version: 1.0 To: Katsaros Kwn/nos Cc: pgsql-jdbc@postgresql.org Subject: Re: Java app and SPI functions References: <1096546604.5994.4.camel@localhost.localdomain> In-Reply-To: <1096546604.5994.4.camel@localhost.localdomain> Content-Type: multipart/mixed; boundary="------------090704050109040506020907" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/213 X-Sequence-Number: 11103 This is a multi-part message in MIME format. --------------090704050109040506020907 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi Ntinos, You don't need to use PL/Java - you can call the SPI functions through standard SQL. I have C functions that return tuples and call them with executeQuery(...). The function in question is defined as CREATE TYPE correlation_type AS ( id INTEGER, num_points INTEGER, correlation FLOAT8 ); CREATE OR REPLACE FUNCTION max_min_correlation(int,smallint,smallint,int,int) RETURNS SETOF correlation_type AS '$libdir/contrib/my_func.so','max_min_correlation' LANGUAGE 'C' STABLE STRICT; and then I call it with ResultSet results = st .executeQuery("SELECT * FROM max_min_correlation("+var+")"); and work through the result set. Good luck, Adriaan Katsaros Kwn/nos wrote: >Hi everybody! > >I'm new to PostgreSQL with JDBC. What I want to do is to connect an >already implemented Java application to my postgresql server.I want to >be able to pass arguments from the java application to some function >I've written in C (that uses SPI functions) and receive tuples to >display in the Java GUI. > >Any hints on where to start from? > >Richard Huxton at the General list kindly pointed me to the PL/Java >project. Is this where I should focus? > >Thanks in advance, >Ntinos Katsaros > > > >---------------------------(end of broadcast)--------------------------- >TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > --------------090704050109040506020907 Content-Type: text/x-vcard; charset=utf-8; name="a.joubert.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="a.joubert.vcf" begin:vcard fn:Adriaan Joubert n:Joubert;Adriaan org:Albourne Partners (Cyprus) Ltd adr:;;3 D. Vikella Street;Nicosia;;1061;Cyprus email;internet:a.joubert@albourne.com tel;work:+357 22 750652 tel;fax:+357 22 750654 x-mozilla-html:FALSE url:http://www.albourne.com version:2.1 end:vcard --------------090704050109040506020907--