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 729D89FB38B for ; Tue, 5 Sep 2006 16:20:10 -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 47795-04 for ; Tue, 5 Sep 2006 16:19:52 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id EA2D39FB3A3 for ; Tue, 5 Sep 2006 16:19:07 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from outbound2-ash-R.bigfish.com (outbound-ash.frontbridge.com [206.16.192.249]) by svr4.postgresql.org (Postfix) with ESMTP id C56B05AF894 for ; Tue, 5 Sep 2006 19:19:01 +0000 (GMT) Received: from outbound2-ash.bigfish.com (localhost.localdomain [127.0.0.1]) by outbound2-ash-R.bigfish.com (Postfix) with ESMTP id 3589F10719A6; Tue, 5 Sep 2006 19:19:00 +0000 (UTC) Received: from mail64-ash-R.bigfish.com (unknown [172.18.2.3]) by outbound2-ash.bigfish.com (Postfix) with ESMTP id 2B4D61071941; Tue, 5 Sep 2006 19:19:00 +0000 (UTC) Received: from mail64-ash.bigfish.com (localhost.localdomain [127.0.0.1]) by mail64-ash-R.bigfish.com (Postfix) with ESMTP id 20CFA6E570C; Tue, 5 Sep 2006 19:19:00 +0000 (UTC) X-BigFish: V Received: by mail64-ash (MessageSwitch) id 115748394044388_727; Tue, 5 Sep 2006 19:19:00 +0000 (UCT) Received: from owa1.spimageworks.com (unknown [160.33.20.31]) by mail64-ash.bigfish.com (Postfix) with ESMTP id C5D096E438C; Tue, 5 Sep 2006 19:18:59 +0000 (UTC) Received: from [172.29.105.69] ([172.30.104.3]) by owa1.spimageworks.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 5 Sep 2006 12:18:59 -0700 Message-ID: <44FDCDA3.7000302@imageworks.com> Date: Tue, 05 Sep 2006 12:18:59 -0700 From: Matt Chambers Reply-To: chambers@imageworks.com Organization: Sony Pictures Imageworks User-Agent: Mozilla Thunderbird 1.0.7-1.4.1.centos4 (X11/20051007) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dave Cramer Cc: pgsql-jdbc@postgresql.org Subject: Re: jdbc3, pg 8.1.4 , and stored procedures References: <44F61B1B.4030009@imageworks.com> <4FBCA43B-C86C-4FEC-ADE1-DBA8986E1760@fastcrypt.com> <44F6309D.7010607@imageworks.com> <2F2DFD51-CFE5-490E-BFA3-A5ACC3448449@fastcrypt.com> In-Reply-To: <2F2DFD51-CFE5-490E-BFA3-A5ACC3448449@fastcrypt.com> Content-Type: multipart/alternative; boundary="------------060408010406050008090605" X-OriginalArrivalTime: 05 Sep 2006 19:18:59.0095 (UTC) FILETIME=[23795270:01C6D120] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.768 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, HTML_40_50, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200609/11 X-Sequence-Number: 15729 This is a multi-part message in MIME format. --------------060408010406050008090605 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Found the problem here. A lot of calls had a semicolon after the SQL, for example '? = call getDispatchList ( ? ); ' I'm guessing this worked with 7.4 since they were treated just like SELECT statements. After fixing that, most worked, except that all of the code was using PreparedStatements instead of CallableStatements which seems to break setting results scrollable or not. Dave Cramer wrote: > > On 30-Aug-06, at 8:43 PM, Matt Chambers wrote: > >> Thanks for response. >> >> Do you happen to know what 'Malformed function or procedure escape >> syntax at offset 4' means? That might get me going in the right >> direction. >> I will see what I can do about a code example.. There are a couple >> layers of abstraction and some casting I would want to put into the >> example. One thing I noticed was that when using the 7.4 driver, >> while it did work, would say "idle in transaction" next to the process. > > > Yeah, that was a bug in the 7.4 driver. As far as the Malformed > function goes. It's a syntax error in the call, but it looks pretty > normal which is why I wanted a self contained test that failed. > > >> >> Also, what I said about every stored procedure, turns out that is >> false. It seems the ones that don't work are the ones that return >> cursors. That code looks something like this. Looks like its >> abstracted to handle normal queries and stored procedure calls. >> ob_is_call is set to true if they are calling a stored procedure, >> false if its a normal query. The SQLCleaner handles close() stuff. >> >> public Tresult query ( PreparedStatement x_stmt, Tparam x_param ) >> throws SQLException { >> ResultSet x_rset = null; >> if ( ob_is_call ) { >> ((CallableStatement) x_stmt).registerOutParameter( 1, >> Types.OTHER ); >> x_stmt.setObject ( 2, x_param ); >> x_stmt.execute (); >> x_rset = (ResultSet) ((CallableStatement) >> x_stmt).getObject(1); >> } else { >> x_stmt.setObject ( 1, x_param ); >> x_rset = x_stmt.executeQuery (); >> } >> try { >> return handle ( x_rset ); >> } finally { >> SqlCleaner.cleanUpSqlSession ( x_rset ); >> } >> } >> >> -Matt >> >> Dave Cramer wrote: >> >>> Matt, >>> >>> That's pretty strange, the test suite in the driver uses exactly >>> the same syntax. >>> Can you send a self contained test that fails ? >>> >>> Dave >>> On 30-Aug-06, at 7:11 PM, Matt Chambers wrote: >>> >>>> Greetings. I've inherited this Tomcat / Postgres application and >>>> I'm having a problem, not sure what is. Basically, its a postgres >>>> 8.1.4 server and a tomcat application. All of the SQL is done in >>>> plpgsql, which is called with prepareCall statements, example: >>>> >>>> "{ ? = call getDispatchList ( ? ) }" >>>> >>>> With the 7.4 driver it works, with the 8.1 driver every query >>>> fails with: >>>> >>>> WARNING: Caught unexpected: org.postgresql.util.PSQLException: >>>> Malformed function or procedure escape syntax at offset 4., >>>> org.postgresql.util.PSQLException: Malformed function or procedure >>>> escape syntax at offset 4. >>>> >>>> I've been able to move the other applications over to the 8.1 >>>> driver (none use stored procedures) no problem. What is the secret? >>> >>> >> >> >> > > -- *Matt Chambers * *Sony Pictures Imageworks* Software Engineer Phone: (310) 840 9072 Cell: (703) 624 0221 --------------060408010406050008090605 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Found the problem here.  A lot of calls had a semicolon after the SQL, for example '? = call getDispatchList ( ? ); '  I'm guessing this worked with 7.4 since they were treated just like SELECT statements.  After fixing that, most worked, except that all of the code was using PreparedStatements instead of CallableStatements which seems to break setting results scrollable or not.

Dave Cramer wrote:

On 30-Aug-06, at 8:43 PM, Matt Chambers wrote:

Thanks for response.

Do you happen to know what 'Malformed function or procedure escape  syntax at offset 4' means?  That might get me going in the right  direction.
I will see what I can do about a code example..  There are a couple  layers of abstraction and some casting I would want to put into the  example.  One thing I noticed was that when using the 7.4 driver,  while it did work, would say "idle in transaction" next to the  process.

Yeah, that was a bug in the 7.4 driver. As far as the Malformed  function goes. It's a syntax error in the call, but it looks pretty  normal which is why I wanted a self contained test that failed.



Also, what I said about every stored procedure, turns out that is  false.  It seems the ones that don't work are the ones that return  cursors.  That code looks something like this.  Looks like its  abstracted to handle normal queries and stored procedure calls.   ob_is_call is set to true if they are calling a stored procedure,  false if its a normal query.  The SQLCleaner handles close() stuff.

   public Tresult query ( PreparedStatement x_stmt, Tparam  x_param ) throws SQLException {
       ResultSet x_rset = null;
       if ( ob_is_call ) {
           ((CallableStatement) x_stmt).registerOutParameter( 1,  Types.OTHER );
           x_stmt.setObject ( 2, x_param );
           x_stmt.execute ();
           x_rset = (ResultSet) ((CallableStatement)  x_stmt).getObject(1);
       } else {
           x_stmt.setObject ( 1, x_param );
           x_rset = x_stmt.executeQuery ();
       }
       try {
           return handle ( x_rset );
       } finally {
           SqlCleaner.cleanUpSqlSession ( x_rset );
       }
   }

-Matt

Dave Cramer wrote:

Matt,

That's pretty strange, the test suite in the driver uses exactly  the same syntax.
Can you send a self contained test that fails ?

Dave
On 30-Aug-06, at 7:11 PM, Matt Chambers wrote:

Greetings.  I've inherited this Tomcat / Postgres application and  I'm having a problem, not sure what is.  Basically, its a  postgres 8.1.4 server and a tomcat application.  All of the SQL  is done in plpgsql, which is called with prepareCall statements,  example:

 "{ ? = call getDispatchList ( ? ) }"

With the 7.4 driver it works, with the 8.1 driver every query  fails with:

WARNING: Caught unexpected: org.postgresql.util.PSQLException:  Malformed function or procedure escape syntax at offset 4.,  org.postgresql.util.PSQLException: Malformed function or  procedure escape syntax at offset 4.

I've been able to move the other applications over to the 8.1  driver (none use stored procedures) no problem.  What is the secret?








--
Matt Chambers <chambers@imageworks.com>
Sony Pictures Imageworks
Software Engineer
Phone: (310) 840 9072
Cell: (703) 624 0221
--------------060408010406050008090605--