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 00C893A5DD3 for ; Sun, 5 Dec 2004 19:49:28 +0000 (GMT) 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 56793-07 for ; Sun, 5 Dec 2004 19:49:18 +0000 (GMT) Received: from smtp3.mailblocks.com (smtp3.mailblocks.com [140.174.9.93]) by svr1.postgresql.org (Postfix) with SMTP id 3D8B63A5E03 for ; Sun, 5 Dec 2004 19:49:18 +0000 (GMT) Received: (qmail 21514 invoked from network); 5 Dec 2004 19:49:18 -0000 Received: from 10.10.0.51 (HELO mailblocks.com) (10.10.0.51) by 10.10.0.93 with SMTP; 5 Dec 2004 19:49:18 -0000 MIME-Version: 1.0 To: Larry White Cc: pgsql-jdbc@postgresql.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed References: <41B35CC6.2030800@mailblocks.com> <41B3663B.1010003@mailblocks.com> X-Accept-Language: en-us, en Content-Transfer-Encoding: 7bit Subject: Re: prepared statement call fails X-MB-Message-Source: ClientSMTP Received: from 82.182.133.12 by app2.mailblocks.com (192.168.225.51) with SMTP (authenticated); Sun, 05 Dec 2004 11:49:17 -0800 X-MB-Message-Type: User Message-Id: From: Thomas Hallgren In-Reply-To: Date: Sun, 05 Dec 2004 20:49:15 +0100 User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.434 tagged_above=0 required=5 tests=AWL, DNS_FROM_AHBL_RHSBL, DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200412/23 X-Sequence-Number: 11689 Larry White wrote: >Thanks Thomas. I'll try it your way to see what happens, but >according to the Postgresql documentation, it should support callable >statements. I posted the relevent text from the JDBC section of the >online docs below: > > > PostgreSQL's JDBC driver fully supports calling PostgreSQL >stored functions. > > Example 31-4. Calling a built in stored function > > This example shows how to call a PostgreSQL built in >function, upper, which simply converts the supplied >string argument to uppercase. > > // Turn transactions off. > con.setAutoCommit(false); > // Procedure call. > CallableStatement upperProc = con.prepareCall("{ ? = call >upper( ? ) }"); > upperProc.registerOutParameter(1, Types.VARCHAR); > upperProc.setString(2, "lowercase to uppercase"); > upperProc.execute(); > String upperCased = upperProc.getString(1); > upperProc.close(); > > > Ok, I did write AFAIK. Apparently my knowlegde didn't extend far enough :-) The JDBC driver must do some trick then, and make an attempt to convert what you wrote into what I suggested. With some risk of getting flogged, I must admin that I disagree with that implementation since the interface doc's for JDBC mandates that the CallableStatement is for Stored Procedures only. Patching it so that it can call functions will cause future problems once the backend really do implement stored procedures correctly. My advice would be to stick with prepared statements until that happens. I know for certain that it works. Regards, Thomas Hallgren