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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is JDBC Batch Processing and what are it’s benefits?

507


How can you retrieve data from the resultset using jdbc?

539


Explain jdbc savepoint?

556


What does jdbc stand for?

498


What is statement and preparedstatement in java?

482






What is jdbc connection string?

499


How do I disallow NULL values in a table?

533


How to move the cursor in scrollable resultset ?

561


What is the fastest type of JDBC driver?

582


What are the three basic components of the odbc architecture?

459


Why isn't the java.sql.DriverManager class being found?

556


How can we move the cursor in a scrollable result set?

537


Why should we close database connections in java?

674


What is difference between statement and preparedstatement in jdbc?

459


Is jdbc part of j2ee?

502