From: Emmanuel C. <ma...@fr...> - 2009-11-18 18:12:33
|
Hi, The sequoia mailing list has moved to seq...@li... > > Hi everyone, presently I encounter a problem about how to call > procedures through sequoia virtual database > > console. Suppose a backend has a procedure in the form 'proc(IN id > integer not null,IN name char(32) not null, > IN score float with null)'. And I tried executing the procedure like this: > {call proc(101,'student',80.0)} > But such statement will raise exceptions from backend database which > says errors like "invalid procedure call > syntax". So I debugged the source code only to find the exceptions > occurs from AbstractLoadBalancer.java, in function > AbstractLoadBalancer::setupCallableStatement(), statement > "cs = c.prepareCall(backend.transformQuery(proc)); ". > If I executed like this: > {call proc(?,?,?)} > The above exception will disappear but no parameters in the procedure > was assigned any value. > So is this a bug in source code ? Or if not, how can I call the > procedure correctly? > If you use a CallableStatement, you are suppose to call a stored procedure this way: CallableStatement cs = connection.prepareCall({call proc(?,?,?)}); cs.setInt(1, 101); cs.setString(2, "student"); cs.setFloat(3, 80.0); cs.executeQuery() or cs.executeUpdate() depending on the result returned. Check for CallableStatement examples in the JDBC documentation. Thanks for your interest in Sequoia. Emmanuel -- Emmanuel Cecchet FTO @ Frog Thinker Open Source Development & Consulting -- Web: http://www.frogthinker.org email: ma...@fr... Skype: emmanuel_cecchet |