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

How can we make sure main() is the last thread to finish in java program?

1202


Is null keyword in java?

947


Which package is imported by default?

1082


When can you say a graph to be a tree?

1085


What is boolean law?

1070


How do you use wildcards?

1063


Does A Class Inherit The Constructors Of Its Superclass?

1076


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

1158


What is abstract class? Explain

1046


What are 5 boolean operators?

1181


Explain the difference between abstract class and interface in java?

990


What does the @override annotation do?

1041


Explain parallel processing in java8?

1259


how to know the total memory occupied by the objects in the ArrayList(Array list may contain duplicate objects)

2342


What is the difference between throw and throws keywords?

1054