methods for

It can not directly be created in code; instead, the Connection interface is created by the
Driver.connect() method.
This method creates a Statement object associated with this Connection session.
This method provides a PreparedStatement object to be associated with this Connection session.
•
•
boolean execute
(
String Sql
)

ResultSet executeQuery
(
String Sql
)

int executeUpdate
(
String Sql
)

1.

It allows us to execute the Statement when we do not
know if it is a query or an update.

2.

It may return multiple results.

3. Use getResultSet to retrieve the ResultSet.

Executes the SQL string and returns a single
ResultSet object.

Executes a SQL string, which must be an
INSERT,UPDATE, DELETE, or a statement that
doesn’t return anything.
Example: Select
Example: Insert
Example: Delete
•
Java DataBase Connectivity - JDBC Part-2
Java DataBase Connectivity - JDBC Part-2
Java DataBase Connectivity - JDBC Part-2
Java DataBase Connectivity - JDBC Part-2
Java DataBase Connectivity - JDBC Part-2

Java DataBase Connectivity - JDBC Part-2

  • 4.
    methods for It cannot directly be created in code; instead, the Connection interface is created by the Driver.connect() method.
  • 5.
    This method createsa Statement object associated with this Connection session.
  • 6.
    This method providesa PreparedStatement object to be associated with this Connection session.
  • 7.
  • 9.
    boolean execute ( String Sql ) ResultSetexecuteQuery ( String Sql ) int executeUpdate ( String Sql ) 1. It allows us to execute the Statement when we do not know if it is a query or an update. 2. It may return multiple results. 3. Use getResultSet to retrieve the ResultSet. Executes the SQL string and returns a single ResultSet object. Executes a SQL string, which must be an INSERT,UPDATE, DELETE, or a statement that doesn’t return anything.
  • 10.
  • 13.
  • 14.
  • 20.