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
What causes no suitable driver error?
How do I set properties for a JDBC driver and where are the properties stored?
What are the different types of interfaces in the api component?
What are different types of JDBC Drivers?
How many categories of jdbc drivers are there?
Is it possible to connect to multiple databases simultaneously? Using single statement can one update or extract data from multiple databases?
What are different parts of a url?
What is a jdbc url?
How do you insert images into database using jdbc?
What are the common tasks of JDBC?
What is the role of class.forname while loading drivers?
What is a statement in java?
What is jdbc and why is it required?
State the three different ways in which you can create a table?
How can you retrieve data from the resultset using jdbc?