|
Re:Difference between Statement and Callable Stmt.
Hi,
Since you are using statement.executeQuery() there will be a resultSet returned from it. But remember that it will be usefull only when we need a resultset with out outparameter.
Suppose if you have the code like this
CallableStatement cstmt = con.prepareCall( \" ?={proced name } \" );
cstmt.registerOutParameter ( 1, java.sql.Types.INTEGER );
cstmt.execute();
int id = cstmt.getInt(1);
You were trying to use a output parameter, so it should be mentioned
there with the \'?\'.
If you have output parameters, a CallableStatement is needed
About speed, you must have to choose callableStatements when you are
having output parameters, otherwise you can have statement.
Hope this helps.
|