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 does jdbc setmaxrows method do?

525


Which jdbc driver is the fastest driver?

561


How can you use preparedstatement in jdbc?

528


What is database deadlock ? How can we avoid them?

529


How can we disable a constraint ?

573






What are the new features available in jdbc 4.0?

539


Explain the process of creating tables using NetBeans IDE?

536


What is difference between odbc and jdbc?

516


Why we use jdbc instead of odbc?

516


What are database warnings in jdbc and how can we handle database warnings in jdbc?

624


What does connection pooling mean ?

585


What are the classes and methods used for sending sql statements to database?

554


What is jdbc and jpa?

525


What are the considerations for deciding on transaction boundaries?

569


What are common JDBC Exceptions?

562