What is actual difference between statement,prepared
statement and callable statement and when we have to use it?
pls post a answer with code and clear explanation. thanks
Answer Posted / aravind
Statement:
When you use normal statements compilation of statement or
parsing of statement will happen everytime. This is time
cosuming when u have mutliple queries to execute.
Statemtn s = conn.createStatement();
s.executeQuery();
Prepared Statement:
In prepared statement SQL query will be compiled or parsed
for the very first time and kept in some kind of pool. When
u execute one more time the same statement with different
values it saves the parsing time.
SQL select * from employee where employeeID=?,empName=?;
PreparedStatement ps = conn.PreparedStatement();
ps.execute(1,aru);
ps.execute(2,arya);
Callable Statement:
Callable statements are used to execute stored procedures
similar to java functions.
| Is This Answer Correct ? | 44 Yes | 5 No |
Post New Answer View All Answers
What is a percentage sign called?
Do I need java on my computer?
What is a generic data type?
Explain wait() method of object class ?
What is the importance of static variable?
How to stop a thread in java? Explain about sleep () method in a thread?
Can we use static class instead of singleton?
What is final keyword?
Explain covariant method overriding in java.
How finally used under exception handling?
What is java thread dump, how can we get java thread dump of a program?
Explain the importance of finalize() method.
What is mnemonic code?
Can we define static methods inside interface?
Does list allow duplicates in java?