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
How does jdbc driver work?
What is jdbc odbc bridge?
What is a datasource in java?
What is getconnection method in java?
What is the query used to display all tables names in SQL Server (Query analyzer)?
What are the higher level apis under development on top of jdbc currently?
How can we set null value in jdbc preparedstatement?
What is the role of jdbc drivermanager class?
What is represented by the connection object?
Result set’s index starts with 0 or 1?
Is uri the same as url?
What is SQL Warning? How to retrieve SQL warnings in the JDBC program?
What are different parts of a url?
What class.forname does, while loading the drivers?
Give an example for execution of sql statement.