Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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

Answers were Sorted based on User's Feedback



What is actual difference between statement,prepared statement and callable statement and when we h..

Answer / 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

What is actual difference between statement,prepared statement and callable statement and when we h..

Answer / sudha

Prepared statement is precompiled statement it is used when
we want one query to be executed n no. of times.
whereas callablestatement is used to call stored procedures

Is This Answer Correct ?    41 Yes 3 No

Post New Answer

More Core Java Interview Questions

What classes of exceptions may be caught by a catch clause in java programming?

0 Answers  


Can you call a private data from an inner class?

6 Answers  


What is java objectoutputstream?

0 Answers  


In java, how many ways you can take input from the console?

0 Answers  


What is the difference between keyword and identifier?

0 Answers  






What is difference between this and super keyword?

0 Answers  


What is the concept of multithreading?

0 Answers  


What are memory tables?

0 Answers   Aspiring Minds,


What is the r character?

0 Answers  


what is the output ? Math.floor(-2.1) a)2 b)-2 c)-3.0 d)0

4 Answers   Accenture,


what is the purpose of class "Object" which is base class for all classes?

3 Answers  


Is static variable stored in heap?

0 Answers  






Categories