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.

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is jdbc oracle thin?

555


What is the return type of execute, executequery and executeupdate?

740


What do you mean by two phase commits?

646


What is device controller?

604


How to check jdbc connection in linux?

589






What is CLOB and BLOB datatypes in JDBC?

639


What are different types of ResultSet?

669


How many locking systems are there in jdbc?

654


What does the connection object represents?

640


What is jdbc stand for?

569


Describe odbc?

622


What are temp tables ?

612


What is an SQL Locator?

667


Is jdbc faster than odbc?

575


How can I connect mysql or oracle with java?

617