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 do you mean by mnemonics?
What is the purpose of javac exe?
What is the static import?
Define how does a try statement determine which catch clause should be used to handle an exception?
What is string data type?
How do you use find and replace?
What is rule of accessibility in java?
Hi.... I applied for the post of scientific officer/Engineer-SB(Programmer).Please post the syllabus and sample papers.
What is Mutex (Mutual Exclusion Object) ?
What is foreach loop in java?
what is the difference between the methods sleep() and wait()? : Java thread
What is the use of System class?
What is merge sort in java?
What is run time allocation?
What is difference between static variable and global variable?