X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 110AB9FB1CA for ; Sat, 22 Jul 2006 21:55:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 77638-01 for ; Sat, 22 Jul 2006 21:55:44 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.191]) by postgresql.org (Postfix) with ESMTP id ADB819FAD5A for ; Sat, 22 Jul 2006 21:55:45 -0300 (ADT) Received: by nf-out-0910.google.com with SMTP id p77so1192856nfc for ; Sat, 22 Jul 2006 17:55:42 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=googlemail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=eBh4UQrIvN24M9+Du5H6O+6piI6On4XLG9Y1wxRvmfbUcaaznpnNDNQ6wNmpTwNwKv2I53ecrDAzLcqjLpQcBEm7RFUYDMwDo2MhfD9AvRNBPPf6n6SlcN/NMYYQK2QE55ivEbDVpiyzVsb1v27MlbNjv8N/EDEXCD5MIkLiMNU= Received: by 10.78.159.7 with SMTP id h7mr960189hue; Sat, 22 Jul 2006 17:55:42 -0700 (PDT) Received: by 10.78.183.20 with HTTP; Sat, 22 Jul 2006 17:55:42 -0700 (PDT) Message-ID: <30b57570607221755q76771c94l84013aef90b16f96@mail.gmail.com> Date: Sun, 23 Jul 2006 01:55:42 +0100 From: "Michael Guyver" To: pgsql-jdbc Subject: Trouble with CallableStatement MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/70 X-Sequence-Number: 15496 Hi there, I'm having trouble getting a CallableStatement to work with the following function CREATE OR REPLACE FUNCTION pro_register_cookie_for_user( prmUserId int8, prmSecureGuid varchar, OUT outUsernameHash varchar, OUT outMaxAge float4) AS $$ ... $$ LANGUAGE plpgsql; The function works fine over pgAdmin, so I think the problem lies in the Java code. callable = conn.prepareCall("{call pro_register_cookie_for_user(?, ?, ?, ?)}"); callable.setLong(1, playerId); callable.setString(2, secureGuid); callable.registerOutParameter(3, Types.VARCHAR); callable.registerOutParameter(4, Types.FLOAT); callable.executeQuery(); String usernameHash = callable.getString(3); float maxAgeF = callable.getFloat(4); When running this on Java 1.5, pgsql-jdbc 8.1.404 and Postgres 8.1, I get the following error: A CallableStatement function was executed and the return was of type java.sql.Types=12 however type java.sql.Types=0 was registered. at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:380) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:250) Can anyone shed some light on what I'm doing wrong? Cheers Michael