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
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 |
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 |
how can be object class inherited to all class in a program when java does not support multiple inheritance??
Explain the purpose of garbage collection in Java?
When is the garbage collection used in Java?
What is the final blank variable?
Can a class be private or protected in java?
What is the difference between object oriented programming language and object based programming language?
What is == mean?
How many inner classes can a class have?
what is the difference between cd & dvd ?
30 Answers Lovely Professional University, Satyam, Sibylsys,
What is the difference between Trusted and Untrusted Applet ?
What are the features of java?
What is difference between jdk,jre and jvm?