Stored Proc resultset empty
Posted by: Rene Dupre
Date: January 01, 2009 11:07AM

I have a stored procedure to do a simple select. When I call the procedure using the MySQL command line, everything works ok (I get 1 row back). But in my java program, I don't get any resultset.

my java code:

CallableStatement cStmt = connect.prepareCall("{call ReadUserbyPK(?)}");
cStmt.setString("inUserID", inUserID);
boolean hadResults = cStmt.execute();
while (hadResults)
{
rs = cStmt.getResultSet();
logger.debug("Got result set row:"+rs.getRow());
hadResults = cStmt.getMoreResults();
}

Output shows getRow() returns zero.
I get an error "Before start of result set" if I try to use rs.

my stored procedure:
DELIMITER $$
DROP PROCEDURE IF EXISTS ReadUserbyPK$$
CREATE PROCEDURE ReadUserbyPK(IN inUserID VARCHAR(25))
BEGIN
SELECT * FROM Userid
WHERE Userid.userName = inUserID;
END$$
DELIMITER ;

Any ideas as to why I'm not getting a resultset?

I'm using mySQL 5.1, and ConnectorJ 5.1.7
Thanks!

Options: ReplyQuote


Subject
Written By
Posted
Stored Proc resultset empty
January 01, 2009 11:07AM
January 24, 2009 04:27PM
January 29, 2009 08:40PM
January 31, 2009 10:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.