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 an advantage of using the jdbc connection pool?

0 Answers  


What is jdbc driver for sql server?

0 Answers  


How can I know when I reach the last record in a table, since JDBC doesn't provide an EOF method?

0 Answers  


What is the JDBC syntax for using a literal or variable in a standard Statement?

0 Answers  


Why do we need jdbc api?

0 Answers  






What is dburl?

0 Answers  


What is jdbc and explain jdbc architecture?

0 Answers  


what is callable statement?

6 Answers   Infogain,


Explain the sequence of steps to connect to the database?

3 Answers   Wipro,


How many locking systems are there in jdbc?

0 Answers  


What is jndi lookup?

0 Answers  


what is connection pooling?

6 Answers   Wipro,


Categories