MySQL Forums
Forum List  »  Stored Procedures

Re: weird error in my JDBC code
Posted by: Guy Harrison
Date: October 18, 2005 05:47PM

This works for me (Connector/J version 3.1.10):

static public void outparameter(Connection MyConnect) throws SQLException {

CallableStatement PreparedProc = MyConnect
.prepareCall("{CALL hello(?)}");
PreparedProc.registerOutParameter(1, Types.CHAR);
boolean hasResults = PreparedProc.execute();
String what = PreparedProc.getString(1);
System.out.println(what);
}

The stored procedure definition looks like this:

CREATE PROCEDURE hello(OUT outparm VARCHAR(20)) NO SQL
BEGIN
SET outparm='World';
END$$

Options: ReplyQuote


Subject
Views
Written By
Posted
2861
October 12, 2005 07:04PM
1879
October 13, 2005 03:32PM
1942
October 15, 2005 06:39PM
1910
October 16, 2005 01:07AM
1758
October 16, 2005 09:32AM
1884
October 16, 2005 06:06PM
1817
October 17, 2005 07:19PM
Re: weird error in my JDBC code
1787
October 18, 2005 05:47PM
1849
October 18, 2005 07:42PM
1840
October 19, 2005 01:56AM
1789
October 19, 2005 01:55AM
1804
October 19, 2005 07:01AM
1856
October 19, 2005 07:04AM
1742
October 19, 2005 08:54PM
1762
October 20, 2005 01:16AM


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.