Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 99517 invoked from network); 21 Apr 2008 02:08:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Apr 2008 02:08:21 -0000 Received: (qmail 79341 invoked by uid 500); 21 Apr 2008 02:08:20 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 79311 invoked by uid 500); 21 Apr 2008 02:08:20 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Delivered-To: moderator for derby-user@db.apache.org Received: (qmail 86051 invoked by uid 99); 18 Apr 2008 15:39:16 -0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) X-MimeOLE: Produced By Microsoft Exchange V6.5.7235.2 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Problem with getting the return value out of my stored procedure Date: Fri, 18 Apr 2008 16:38:35 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Problem with getting the return value out of my stored procedure Thread-Index: AcihaornnLRtX4hsSIuVDLb0/F6++A== From: "Hammonds, Nicholas" To: X-OriginalArrivalTime: 18 Apr 2008 15:38:35.0481 (UTC) FILETIME=[43B83490:01C8A16A] X-Virus-Checked: Checked by ClamAV on apache.org Hi, I'm creating a stored derby with the following code =3D=3D=3D=3D=3D=3D=20 String sql =3D "CREATE PROCEDURE testproc(" + "IN S_YEAR INTEGER, OUT RETTOT INTEGER) " +=20 "PARAMETER STYLE JAVA CONTAINS SQL LANGUAGE JAVA EXTERNAL NAME " + "'net.thus.unittest.StoredProcStuff.javaTestProc'"; =20 =20 Statement stat =3D con.createStatement(); stat.execute(sql); =3D=3D=3D=3D=3D=3D=3D=3D The matching java method=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D public static void javaTestProc(int a, int[] b ) { System.out.println("paramOne is " + a); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D I can call the procedure fine and see that I am able to pass the parameter in, although I don't have a clue how to get a return value out. This is how I'm invoking the store procedure CallableStatement addMessage; addMessage =3D (CallableStatement)con.prepareCall( "{call testproc(?,?)}"); addMessage.setInt(1, 666); addMessage.registerOutParameter(2, Types.NUMERIC); addMessage.execute(); all works fine then I try to get the result out of it with int retVal =3D addMessage.getInt(2); That returns 0, obviously I haven't set any return value. So my question is what do I need to in my javaTestProc routine so I can make it return any int value I want it to. Thanks Nic