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 / kaviarasan

Good Question .

Berofe Writing the prepared statement ...
every one of us ill load the driver by using
Class.forName("Some driver which has the Driver class")

Here the this Driver Class/object triggers out the other
classes in which that class implements the neccessary
interface for the operation ....

preparedStatement ps=connection.getPreparedstatement();

this function ill returns the object from the Driver
instancianted class

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can I set up a connection pool with multiple user IDs? The single ID we are forced to use causes problems when debugging the DBMS.

606


What is statement and preparedstatement in java?

570


When do we get java.sql.SQLException: No suitable driver found?

627


What is jdbc thin client in oracle?

570


How we store procedure in oralce for callable statements in jdbc

1930






password, is stored in as plain text. What can I do to protect my passwords?

587


What are the measures to connect to the db using jdbc?

549


How to move the cursor in scrollable resultset ?

675


Can I get a null resultset?

625


What does it mean to "materialize" data?

620


How to use JDBC to connect Microsoft Access?

671


What are the new features added to JDBC 4.0?

621


Describe how the jdbc application works.

605


What is the JDBC syntax for using a literal or variable in a standard Statement?

634


How do I receive a ResultSet from a stored procedure?

597