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

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


Please Help Members By Posting Answers For Below Questions

What is multi-catch block in java?

1057


What do you mean by hashing?

1090


What are the advantages of exception handling in java?

1037


how to handle exceptions in ejb?

2294


What is the difference between array list and vector in java?

924


Does importing a package imports its sub-packages as well in java?

960


What is jee6?

1082


Explain wrapper classes in java?

972


What is the difference between class & structure?

1200


What are the ways in which a thread can enter the waiting state?

931


How can we create an immutable class in java?

1053


What is a void in java?

1139


What is the difference between double and float variables in java?

1122


What is toarray method in java?

1078


Which is better 64 bit or 32 bit?

926