Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Is a class subclass of itself?

0 Answers  


What does || mean in code?

0 Answers  


What is the difference(or similarity if there are some) between object and a variable?

4 Answers   ME,


How variables are stored in memory?

0 Answers  


How to do a true java ping from windows?

0 Answers  


Difference between static and dynamic class loading.

0 Answers  


How can we use primitive data types as objects?

0 Answers  


public class Test { public static void main(String[] args) { int countA = 0; int countB = 0; int countC = 0; int countD = 0; int countE = 0; int countF = 0; int countG = 0; int countH = 0; int countI = 0; int countJ = 0; int countK = 0; int countL = 0; int countM = 0; int countN = 0; int countO = 0; int countP = 0; int countQ = 0; int countR = 0; int countS = 0; int countT = 0; int countU = 0; int countV = 0; int countW = 0; int countX = 0; int countY = 0; int countZ = 0; } } Can anybody tell me any alternate solution(like loop or something) to automate this initialization process. Ex:- for(char chr='A';chr<='Z'; chr++) { (int) String "count"+chr = 0; }

0 Answers  


What is the best way to findout the time/memory consuming process?

0 Answers  


Can a string be null?

0 Answers  


Is 0 true or is 1 true?

0 Answers  


Is main a keyword in java?

0 Answers  


Categories