View Single Post

  #2 (permalink)  
Old 08-20-2004, 11:11 AM
Vasu Vasu is offline
Senior Member
 
Join Date: Nov 2004
Posts: 132
Vasu
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.
Reply With Quote