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 / kanu
Since the prepared statement is a precompiled statement and
this SQL statement is sent to the DBMS right away, where it
is compiled. As a result, the PreparedStatement object
contains not just an SQL statement, but an SQL statement
that has been precompiled. This means that when the
PreparedStatement is executed, the DBMS can just run the
PreparedStatement SQL statement without having to compile
it first.
| Is This Answer Correct ? | 4 Yes | 8 No |
Post New Answer View All Answers
Is jdbc an api?
What is jdbc driver for sql server?
What are the steps involved in establishing a connection using jdbc in java?
What are common JDBC Exceptions?
How many rowset are available in jdbc?
Expalin the method of calling a stored procedure from jdbc.
What is java soft framework?
What does the jdbc databasemetadata interface?
What is jdbc and its types?
Why do we need jdbc api?
List the common jdbc exceptions ?
What are the different types of statements in jdbc?
How to test jdbc connection to sql server?
Explain the various types of locking system in jdbc?
I have the choice of manipulating database data using a byte[] or a java.sql.blob. Which has best performance?