X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 165044762EF for ; Fri, 28 Mar 2003 18:41:01 -0500 (EST) Received: from lucifer.akyasociados.com.ar (unknown [200.69.203.237]) by postgresql.org (Postfix) with ESMTP id 917F34762EF for ; Fri, 28 Mar 2003 18:40:28 -0500 (EST) Received: from taz.oficina (taz.oficina [192.168.1.197]) (authenticated bits=0) by lucifer.akyasociados.com.ar (8.12.8/8.12.8) with ESMTP id h2SNiAkw073511; Fri, 28 Mar 2003 20:44:10 -0300 (ART) (envelope-from franco@akyasociados.com.ar) From: Franco Bruno Borghesi Organization: AK y Asociados S.R.L. To: "Zodiac" , Subject: Re: Stored procedures Date: Fri, 28 Mar 2003 20:40:58 -0300 User-Agent: KMail/1.5 References: <006301c2f579$d21e8a60$7739e2c2@zodiacfhynm2is> In-Reply-To: <006301c2f579$d21e8a60$7739e2c2@zodiacfhynm2is> MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Boundary-02=_L2Nh+ZSLqJeNbML"; charset="koi8-r" Content-Transfer-Encoding: 7bit Message-Id: <200303282040.59217.franco@akyasociados.com.ar> X-Spam-Status: No, hits=-35.0 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,PGP_SIGNATURE_2, REFERENCES,REPLY_WITH_QUOTES,UPPERCASE_25_50,USER_AGENT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200303/633 X-Sequence-Number: 12671 --Boundary-02=_L2Nh+ZSLqJeNbML Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: quoted-printable Content-Description: signed data Content-Disposition: inline Here is a full example of a java program showing the data from a set return= ing=20 function: ------------------------- --IN YOUR DATABASE CREATE TABLE people (name TEXT); INSERT INTO people VALUES ('john'); INSERT INTO people VALUES ('peter'); INSERT INTO people VALUES ('joe'); CREATE FUNCTION getPeople() RETURNS SETOF people AS ' DECLARE rec RECORD; BEGIN FOR rec IN SELECT name FROM people LOOP RETURN NEXT rec; END LOOP;=20=20=20 RETURN; END;' LANGUAGE 'plpgsql'; ------------------- --ListPeople.java import java.sql.*; public class ListPeople { public static void main(String[] args) {=20=20=20 try { Class.forName("org.postgresql.Driver"); Connection=20 con=3DDriverManager.getConnection("jdbc:postgresql:franco?user=3Dadmin"); Statement stmt=3Dcon.createStatement(); ResultSet rs=3Dstmt.executeQuery("SELECT * FROM getPeople()"); while (rs.next()) { System.out.println(rs.getString("name")); } } catch (Exception e) { System.out.println("Exception: "+e.getMessage()); } } } On Friday 28 March 2003 19:31, Zodiac wrote: > Hello! > Can anybody tell me one thing. > How can i call stored procedures in my java-programm? > > Thanks for any help. --Boundary-02=_L2Nh+ZSLqJeNbML Content-Type: application/pgp-signature Content-Description: signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQA+hN2Lz/PwDAvtu7oRAnJrAJ4geO7rUApHWAkBSbqhWLBKllAowACcCuAV XVTXtEowsyWtwGaRalrCPyE= =z++N -----END PGP SIGNATURE----- --Boundary-02=_L2Nh+ZSLqJeNbML--