correct me if I'm wrong, but I count only 10
parameters. in one line you have
cstmt.registerOutParameter(11, Types.VARCHAR);

where is the 11th parameter?

peter lin



--- "Turner, John" <[EMAIL PROTECTED]> wrote:
> 
> Thanks, but I'm not getting any Java-related error
> messages.  The Java code
> just blows right on through, as everything keys off
> of the return status,
> which is always "false" or "negative".  This is
> because the stored procedure
> never executes, and according to the debug log
> printed by the driver, it's
> parameter related...that is, whatever I am doing
> with set*() and
> registerOutParameter() doesn't match up with what
> the procedure is
> expecting.
> 
> That's my question...can anyone point me to a
> resource that shows how to
> call real-world stored procedures correctly with
> CallableStatement?  By
> "real-world" I don't mean rudimentary "take two
> numbers and add them
> together" or "get a row from a table" procedures, I
> can already do that.
> I'm looking for a more advanced tutorial, something
> that shows how to have
> inputs, outputs, in/outputs, and a return status,
> all at once.  It must be
> possible, I just can't figure it out, and can't find
> any resources that
> explain how to do it.  We have VB DLLs calling these
> procedures in
> production, so I know the procedures work, at least
> in conjunction with VB.
> 
> John Turner
> 
> -----Original Message-----
> From: Jim Urban
> [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 19, 2002 5:05 PM
> To: 'Tomcat Users List'
> Subject: RE: OFF-TOPIC: Pointers to
> CallableStatement docs?
> 
> 
> What error are you receiving?  Can you post a stack
> trace and a code clip
> with line numbers so we can see what is failing?
> 
> 
> Jim Urban - [EMAIL PROTECTED]
> Park City Solutions Inc.
> Clinical Connectivity Suite Product Manager
> Suite 295
> 500 Park Blvd.
> Itasca, IL  60143
> Voice:  (630) 250-3045 x106
> Fax:  (630) 250-3046
> 
> CONFIDENTIALITY NOTICE
> This message and any included attachments are from
> Park City Solutions Inc.
> and are intended only for the entity to which it is
> addressed. The contained
> information is confidential and privileged material.
> If you are not the
> intended recipient, you are hereby notified that any
> use, dissemination, or
> copying of this communication is strictly prohibited
> and may be unlawful. If
> you have received this communication in error please
> notify the sender of
> the delivery error by e-mail or call Park City
> Solutions Inc. corporate
> offices at (435) 654-0621
> 
> -----Original Message-----
> From: Turner, John [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 19, 2002 1:27 PM
> To: 'Tomcat Users List'
> Subject: RE: OFF-TOPIC: Pointers to
> CallableStatement docs?
> 
> 
> Thanks!  I've set up my code as you've described,
> but no luck.  For example,
> here is the relevant portion of the stored procedure
> declaring the
> parameters (forgive me, I don't work with stored
> procedures that often, so
> this may not be the right portion of the procedure
> to focus on):
> 
>         @userid_in varchar(8),
>         @password_in varchar(8),
>         @ip_addr varchar(15),
>         @http_referer varchar(80),
>         @http_user_agent varchar(80),
>         @pwdvalid bit OUTPUT,
>         @userenabled bit OUTPUT,
>         @graceexceeded bit OUTPUT,
>         @adminuser char(1) OUTPUT,
>         @title varchar(4) OUTPUT
> 
> My code looks like this:
> 
>         // prepare the stored procedure statement
>         try {
>             cstmt = sConn.prepareCall("{? = call
> sp_validate_pwd(?,?,?,?,?,?,?,?,?,?)}");
>         } catch (SQLException sqle) {
>             sqle.printStackTrace();
>         }
> 
>         // set the input parameters
>         try {
>             cstmt.setString(2, strUserID);
>             cstmt.setString(3, strPassword);
>             cstmt.setString(4, strRemoteAddress);
>             cstmt.setString(5, strReferURL);
>             cstmt.setString(6, strHTTPUserAgent);
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
> 
>         // register the output parameters for the
> stored procedure
>         try {
>             cstmt.registerOutParameter(1,
> Types.INTEGER);
>             cstmt.registerOutParameter(7,
> Types.BIT);
>             cstmt.registerOutParameter(8,
> Types.BIT);
>             cstmt.registerOutParameter(9,
> Types.BIT);
>             cstmt.registerOutParameter(10,
> Types.CHAR);
>             cstmt.registerOutParameter(11,
> Types.VARCHAR);
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
> 
>         // execute the stored procedure
>         try {
>             cstmt.execute();
>         } catch (SQLException sqle) {
>             sqle.printStackTrace();
>         }
> 
>         // grab the results from the stored
> procedure call
>         try {
>             spReturnStatus = cstmt.getInt(1);
>             isValid = cstmt.getBoolean(7);
>             isEnabled = cstmt.getBoolean(8);
>             isExceeded = cstmt.getBoolean(9);
>             strAdmin = cstmt.getString(10);
>             strTitle = cstmt.getString(11);
>         } catch (SQLException sqle) {
>             sqle.printStackTrace();
>         }
> 
>         cstmt = null;
> 
> I've tried different calls, putting the output
> parameters first (2-6) and
> the inputs last (7-11), I've tried no return value,
> putting that return
> value at the end (#11), etc. with no luck.  All of
> the variables in the
> setString() methods are set before calling
> setString().  Am I at least on
> the right track with the code shown above?  Or have
> I completely missed it?
> 
> Thanks again for replying!
> 
> John Turner
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 19, 2002 2:14 PM
> To: Tomcat Users List
> Subject: RE: OFF-TOPIC: Pointers to
> CallableStatement docs?
> 
> 
> 
> It's been sometime since I used JDBC and SQL Server.
> But here are a few
> points to note:
> 1) Your first "?" is the return status. It should be
> registered as an OUT
> parameter.
> 2) Remember to use the right JDBC type when
> registering the OUT parameters.
> This is of utmost importance.
> 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to