Sorry, let me clarify a bit, I know normally Stored Procedure with
CallableStatment is not frequently use nowadays because we are now
having 3 layer design. It is important in the old days with where
client directly interact with database.
It is actually for learning purpose on CallableStatement. Previously,
I am using MySQL to create PROCEDURE as follows:
DELIMETER $$
DROP PROCEDURE IF EXISTS 'jdbc'.'addUser' $$
CREATE PROCEDURE 'jdbc'.'addUser' (in pname varchar(45), in birthday
date, in money float, out pid int)
BEGIN
insert into user(name, birthday, money) values (pname, birthday,
money);
END $$
DELIMETER ;
and I use java callableStatment to get the result of "out" from the
PROCEDURE, java code as follows:
String sql = "{ call addUser(?,?,?,?) }";
callableStatement = connectino.prepareCall(sql);
callableStatement.registerOutParameter(4, Types.INTEGER);
callableStatement.setString(1, "Ken");
callableStatement.setDate(2, new
java.sql.Date(System.currentTimeMillis()));
callableStatement.setFloat(3, 100f);
callableStatement.executeUpdate();
int id = cs.getInt(4); // this is the code that I can retrieve the
result from PROCEDURE
after that I decided to give H2 Database a try, but the PROCEDURE in
h2 doesn't seems like the normal Stored Procedure.
or actually the above scenario not able to achieve in H2 if I
forcefully want to use CallableStatment since it is not supported ?
On Sep 27, 6:16 am, Kerry Sainsbury <
ke...@fidelma.com> wrote:
> On Mon, Sep 27, 2010 at 10:01 AM, Sergi Vladykin
> <
sergi.vlady...@gmail.com>wrote:
> > <
h2-database%2Bunsu...@googlegroups.com<
h2-database%252Buns...@googlegroups.com>