Statement or Prepared Statement?
Hi,
Since the PreparedStatement is a Precompiled Statement , can i use it for normal SQL statements where i need to pass a parameter for a select statement like:-
Instead of this:-
"Select name from employee where empId= "+empId
Shall i use :-
PreparedStatement ps=con.prepareStatement( "Select name from employee where empId= ?")
Resultset rs=ps.executeQuery();
if(rs.next()){
rs.setString(1,empId);
ps.executeUpdate();
}
Which one is better here? Where i havn't used PreparedStatement repeated execution of statement here. Pls. do provide a solution...
Thanks,
--JavaCrazyLover--

