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

Why is odbc needed?

488


What is a jdbc connection pool?

502


What is difference between jdbc and odbc?

487


Which is better odbc or jdbc?

499


Describe the steps needed to execute a sql query using jdbc.

541






How to use JDBC API to call Stored Procedures?

545


Explain about the drive manager class working?

595


What is resultsetmetadata?

494


What is the fastest type of JDBC driver?

586


Explain jdbc savepoint?

558


Is jdbc open source?

448


What is a lock in jdbc?

537


Can I enable requests to a jdbc connection pool for a database connection to wait until a connection is available?

463


Does jdbc require oracle client?

517


What is isolation level? How to set it?

1630