Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 35242 invoked from network); 21 May 2007 14:46:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 May 2007 14:46:54 -0000 Received: (qmail 53990 invoked by uid 500); 21 May 2007 14:46:57 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 53969 invoked by uid 500); 21 May 2007 14:46:57 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 53951 invoked by uid 99); 21 May 2007 14:46:57 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2007 07:46:57 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of jeffgbutler@gmail.com designates 64.233.184.224 as permitted sender) Received: from [64.233.184.224] (HELO wr-out-0506.google.com) (64.233.184.224) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2007 07:46:51 -0700 Received: by wr-out-0506.google.com with SMTP id i23so1323285wra for ; Mon, 21 May 2007 07:46:30 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=iJt1PzDZ7WrbOAr75Fam1JJH4pZbXk7OvGITBigNMxUzxbEJqZmSM012zBB42xydRhvBa4pkplR6tCGZVHg3pZ8i4gIgfTJezAG/bEe3xDOCRT8xBkslLJSMrxkJHhyWXwghyO8HaG2APBVJZrc9AMTbbuZWOHycgvlBC2L66I8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=pLGxoRCzBvfUFOG9Wqd5oNLcJbq3UuVIfRGJiaUXwL6EiIyK/Zak9N8I6tf9RTl6uQ1S8gHoI6NUrCK/pYXA+j8MZnpAFwXEyl7h+jR+OCRn4AfRLA4b3Usmy1OFaACD9rSk9SiPq7W0HiG/wStVRgxcTn3kBWTUSE5DaQwiMeA= Received: by 10.114.169.2 with SMTP id r2mr2740040wae.1179758789654; Mon, 21 May 2007 07:46:29 -0700 (PDT) Received: by 10.115.111.7 with HTTP; Mon, 21 May 2007 07:46:24 -0700 (PDT) Message-ID: Date: Mon, 21 May 2007 09:46:24 -0500 From: "Jeff Butler" To: user-java@ibatis.apache.org Subject: Re: Retrieve stored proc return code In-Reply-To: <8eed5c5b0705210725g47b89334n9a7f559c4df307b7@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_86496_30350787.1179758784587" References: <10691634.post@talk.nabble.com> <8eed5c5b0705210725g47b89334n9a7f559c4df307b7@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_86496_30350787.1179758784587 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline It sounds like you're not registering an output parameter. Here's an example: {? = call some_proc (?,?)} Jeff Butler On 5/21/07, Mikael Andersson wrote: > > Hi, > I'm running into problems getting the return code from a sybase stored > procedure as well. > > I have tried the {? = call someproc(?,?)} construct, but it gives me the > following error message : > Cause: java.sql.SQLException : JZ0SC: Callable Statement: attempt to set > the return status as an input parameter.; > > I'm no DB guru, quite the opposite, and I've tried various apporaches > without success. > Tried defining a parameter element in the parameterMap, got an error > message. > > I have read through what I think are the relevant bits in "iBatis in > Action", but haven't found a solution yet. > > Does the stored procedure have to be created in a certain way to allow me > to grab a hold of the status code? > > Help greatly appreciated, > Mike > > > > > On 19/05/07, Jeff Butler wrote: > > > > By return code, do you mean something that can be obtained like this: > > > > {? = call someproc(?,?)} > > > > If so, then you can use the above syntax and register an output > > parameter. > > > > Jeff Butler > > > > > > On 5/18/07, BenBaril wrote: > > > > > > > > > Hi All, > > > > > > I know this issue has come up before, but I'm curious if there is a > > > solution. I am in the process of evaluating iBatis (and we have pretty > > > much > > > decided on it) as the sql mapper for our IT-Revitalization project. We > > > have > > > over 1000 Stored Procedures in a Sybase database. So far we have > > > gotten > > > around issues such as not having a handle on the connection to > > > retrieve > > > RAISERROR messages from a stored procedure as well as limiting the > > > number of > > > results. > > > > > > Our problem right now is that we cannot retrieve the return code from > > > an SP. > > > We rely heavily on return codes to determine why a stored procedure > > > may have > > > failed, and we need these codes to propagate back up the Java stack so > > > we > > > can have a handle on them. > > > > > > Is there a way to do this using iBatis right now? > > > > > > Thank you, > > > Benjamin Baril > > > -- > > > View this message in context: http://www.nabble.com/Retrieve-stored-proc-return-code-tf3780537.html#a10691634 > > > > > > Sent from the iBATIS - User - Java mailing list archive at Nabble.com > > > . > > > > > > > > > ------=_Part_86496_30350787.1179758784587 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline

It sounds like you're not registering an output parameter.  Here's an example:

<sqlMap namespace="sqlMap">
  <parameterMap class="map" id="theParameterMap">
    <parameter property="rc" javaType="java.lang.Integer" jdbcType="INTEGER" mode="OUT" />
    <parameter property="parm1" javaType="java.math.Integer" jdbcType="INTEGER" mode="IN" />
    <parameter property="parm2" javaType="java.math.Integer " jdbcType="INTEGER" mode="IN" />
  </parameterMap>

  <procedure id="adder" parameterMap="theParameterMap">
    {? = call some_proc (?,?)}
  </procedure>
</sqlMap>

Jeff Butler 

 



On 5/21/07, Mikael Andersson <mail.micke@gmail.com> wrote:
Hi,
I'm running into problems getting the return code from a sybase stored procedure as well.

I have tried the {? = call someproc(?,?)} construct, but it gives me the following error message :
Cause: java.sql.SQLException : JZ0SC: Callable Statement: attempt to set the return status as an input parameter.;

I'm no DB guru, quite the opposite, and I've tried various apporaches without success.
Tried defining a parameter element in the parameterMap, got an error message.

I have read through what I think are the relevant bits in "iBatis in Action", but haven't found a solution yet.

Does the stored procedure have to be created in a certain way to allow me to grab a hold of the status code?

Help greatly appreciated,
Mike





On 19/05/07, Jeff Butler <jeffgbutler@gmail.com > wrote:
By return code, do you mean something that can be obtained like this:
 
{? = call someproc(?,?)}
 
If so, then you can use the above syntax and register an output parameter.
 
Jeff Butler

 
On 5/18/07, BenBaril <benjamin.baril@fbn.ca > wrote:

Hi All,

I know this issue has come up before, but I'm curious if there is a
solution. I am in the process of evaluating iBatis (and we have pretty much
decided on it) as the sql mapper for our IT-Revitalization project. We have
over 1000 Stored Procedures in a Sybase database. So far we have gotten
around issues such as not having a handle on the connection to retrieve
RAISERROR messages from a stored procedure as well as limiting the number of
results.

Our problem right now is that we cannot retrieve the return code from an SP.
We rely heavily on return codes to determine why a stored procedure may have
failed, and we need these codes to propagate back up the Java stack so we
can have a handle on them.

Is there a way to do this using iBatis right now?

Thank you,
Benjamin Baril
--
View this message in context: http://www.nabble.com/Retrieve-stored-proc-return-code-tf3780537.html#a10691634
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.




------=_Part_86496_30350787.1179758784587--