Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


Hi my doubt is that preparedStatement is a interface means
which has no implemenation.plz go thru the code below
String sql = "SELECT * FROM movies WHERE year_made = ?";
prest = con.prepareStatement(sql);
prest.setInt(1,2002);
ResultSet rs1 = prest.executeQuery();

Now setInt and executeQuery how it works since it is
interface it does not have implementation how it works, how
executeQuery returns result from database as executequery
method has no implementation even in Statement interface.

Answers were Sorted based on User's Feedback



Hi my doubt is that preparedStatement is a interface means which has no implemenation.plz go thru ..

Answer / kaviarasan

Good Question .

Berofe Writing the prepared statement ...
every one of us ill load the driver by using
Class.forName("Some driver which has the Driver class")

Here the this Driver Class/object triggers out the other
classes in which that class implements the neccessary
interface for the operation ....

preparedStatement ps=connection.getPreparedstatement();

this function ill returns the object from the Driver
instancianted class

Is This Answer Correct ?    3 Yes 0 No

Hi my doubt is that preparedStatement is a interface means which has no implemenation.plz go thru ..

Answer / shaik

If ur doubt is "PreparedStatement is an interface, how can
we have an object for it" , then ans is.

PreparedStatement object is the object of one of the
implementation class(that implements PreparedStatement(I))
of PreparedStatement(I).

Is This Answer Correct ?    2 Yes 3 No

Hi my doubt is that preparedStatement is a interface means which has no implemenation.plz go thru ..

Answer / kanu

Since the prepared statement is a precompiled statement and
this SQL statement is sent to the DBMS right away, where it
is compiled. As a result, the PreparedStatement object
contains not just an SQL statement, but an SQL statement
that has been precompiled. This means that when the
PreparedStatement is executed, the DBMS can just run the
PreparedStatement SQL statement without having to compile
it first.

Is This Answer Correct ?    4 Yes 8 No

Hi my doubt is that preparedStatement is a interface means which has no implemenation.plz go thru ..

Answer / arin

just return the resultset rs.Its sufficient.

Is This Answer Correct ?    0 Yes 4 No

Post New Answer



More JDBC Interview Questions

What is jdbc and jpa?

0 Answers  


What are the differences between stored procedure and functions?

0 Answers  


Why do we need jdbc driver?

0 Answers  


How a driver can be loaded?

1 Answers  


Is there another way of dealing with the result set that could execute faster?

0 Answers  






how do we get the connection from connection pool

1 Answers  


How does jdbc driver work?

0 Answers  


What's the benefit for specifying constraints like not null, primary key explicitly instead of specifying it against the column ?

0 Answers  


What do you mean by jdbc batch processing and what are the advantages of using jdbc batch processing?

0 Answers  


How to check jdbc driver version in sql server?

0 Answers  


How does jdbc work?

0 Answers  


How can I use the JDBC API to access a desktop database like Microsoft Access over the network?

0 Answers  






Categories