Try this:
private static final String
SQL_CALL_GETTERMIDS = "exec P.dbo.TO_GetTermIDs
@term=?,@symbol=?,@side=?,@where=?,@rowcount=?,@num_term_ids=?,@time_in_ms=?";
private static final int INIT_IDS_LIST_SIZE = 50;
1,2,3,4 and 5 are input parameters 6 and 7 are output. This is using
microsoft sql driver.
conn = connPoolMgr.getConnection();
CallableStatement cs =
(CallableStatement)connPoolMgr.getUserData(conn);
cs.setString(1, request.termId);
cs.setString(2, request.symbol);
cs.setString(3, request.side);
cs.setString(4, request.whereClause);
cs.setString(5, request.maxTermIdsReturned);
cs.registerOutParameter(6, Types.NUMERIC);
cs.registerOutParameter(7, Types.NUMERIC);
ResultSet rs = cs.executeQuery();
ArrayList ids = new ArrayList(INIT_IDS_LIST_SIZE);
while (rs.next())
{
String id = rs.getString(1);
ids.add(id);
}
HTH
d.
Turner, John wrote:
> The 11th is the return_status. Actually, #1 is the return status.
> According to the CallableStatement docs, you have to account for every "?"
> in your statement. There is 1 return status, 5 input parameters, and 5
> output parameters: 1 + 5 + 5 = 11.
>
> cstmt = sConn.prepareCall("{? = call
> sp_validate_pwd(?,?,?,?,?,?,?,?,?,?)}");
>
> John Turner
>
> -----Original Message-----
> From: Peter Lin [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 20, 2002 8:07 AM
> To: Tomcat Users List
> Subject: RE: OFF-TOPIC: Pointers to CallableStatement docs?
>
>
>
> 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
>>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>
--
David Mossakowski [EMAIL PROTECTED]
Instinet Corporation 212.310.7275
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>