What is PreparedStatement?

Answers were Sorted based on User's Feedback



What is PreparedStatement?..

Answer / mathivanan

Statement:
Where we r going to a loop the SQL query has to be
compiled every iteration.

PreparedStatement:
Unlike Statement the SQL query is compiled one time and
use that pre_compiled query in all iteration. So it reduces
the execution time
While declaring the PreparedStatement itself v can give
the query which has to performed.

Is This Answer Correct ?    23 Yes 2 No

What is PreparedStatement?..

Answer / manojkumar.l

It will execute before commit sql query and also execute
multiple select statement,it will save time,faster
execution.

Is This Answer Correct ?    12 Yes 0 No

What is PreparedStatement?..

Answer / harish

Some times it is more convinient to use this for sending
SQL statements to the DBMS. The main feature , which
distinguishes it from its super class statement is that
unlike statement,it is given an SQL statement right when it
is created. This SQL statement is then sent to the DBMS
righat away,where is it compiled.

Is This Answer Correct ?    13 Yes 5 No

What is PreparedStatement?..

Answer / sowmya

prepared statement is the type of statement used to
interact with database.
To avoid syntactical complexities its the better approach
(eg:double quotes used with query strings)
we can insert many rows using single prepared statement.
eg:String str="insert into tab values("?,?,?")";
PreparedStatement stmt=con.prepareStatement(str);

Is This Answer Correct ?    7 Yes 2 No

What is PreparedStatement?..

Answer / suresh

PreparedStatements are precompiled. When you create a
PreparedStatement you supply a SQL statement. This statement
is passed right along to your database where it is compiled
and cached. The advantage of this is that if you are running
a query multiple times the database will not have to compile
it each time before it is run. This can result in a hefty
performance boost.


Read more: How to use a Java Prepared Statement | eHow.com
http://www.ehow.com/how_5386522_use-java-prepared-statement.html#ixzz12INtbKn4

Is This Answer Correct ?    0 Yes 1 No

What is PreparedStatement?..

Answer / guest

There's a popular belief that using a PreparedStatement
object is faster than using a Statement object. After all, a
prepared statement has to verify its metadata against the
database only once, while a statement has to do it every
time. So how could it be any other way? Well, the truth of
the matter is that it takes about 65 iterations of a
prepared statement before its total time for execution
catches up with a statement. This has performance
implications for your application, and exploring these
issues is what this section is all about.

When it comes to which SQL statement object performs better
under typical use, a Statement or a PreparedStatement, the
truth is that the Statement object yields the best
performance. When you consider how SQL statements are
typically used in an application--1 or 2 here, maybe 10-20
(rarely more) per transaction--you realize that a Statement
object will perform them in less time than a
PreparedStatement object. In the next two sections, we'll
look at this performance issue with respect to both the OCI
driver and the Thin driver.

Is This Answer Correct ?    0 Yes 8 No

Post New Answer

More JDBC Interview Questions

What is the role of the jdbc drivermanager class?

0 Answers  


What is jdbc odbc bridge?

0 Answers  


What is getconnection method in java?

0 Answers  


Hi........I need to create a dropdown box using java.....this box should show the values that should be taken from the database...... Thank you....

1 Answers  


How to connect multiple database in jdbc?

0 Answers  






What are the different classes through which JDBC represents statements?

0 Answers  


Explain the difference between rowset vs. Resultset in jdbc?

0 Answers  


What is namedparameterjdbctemplate?

0 Answers  


What do you mean by metadata and why we are using it?

0 Answers  


Why do I get UnsatisfiedLinkError when I try to use my JDBC driver?

0 Answers  


What are the different types of modifiers?

2 Answers  


What type of driver you use in real-time projects?

3 Answers  


Categories