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
Once I have the Java 2 SDK, Standard Edition, from Sun, what else do I need to connect to a database?
What is jdbc odbc bridge?
What is com mysql jdbc driver?
Which type of driver is unique in jdbc?
What do you understand by DDL and DML statements?
Why can't Tomcat find my Oracle JDBC drivers in classes111.zip?
Why would you use setautocommit(false) in jdbc?
How many packages are available in jdbc api?
Why we use while rs next ())?
Can resultset be null in java?
What do you understand by jdbc driver and explain its types?
What is an advantage of using the jdbc connection pool?
What is savepoint in jdbc?
Name the method, which is used to prepare a callablestatement.
Name the new features added in jdbc 4.0.