View RSS Feed

Java Database

Executing PreparedStatement Objects

Rating: 1 votes, 5.00 average.
by , 03-10-2012 at 09:03 AM (1704 Views)
  • Execute statement shall be called for execution of a PreparedStatement Object.
  • The executeQuery when just 1 ResultSet is returned by query,
  • The executeUpdate when no ResultSet is returned by query.
  • The execute when one or more than one ResultSet object return by query.

Call of “execute update” method is explained by this code.
Java Code:
updateSales.setInt(1, e.getValue().intValue());
updateSales.setString(2, e.getKey());
updateSales.executeUpdate();
updateTotal.setInt(1, e.getValue().intValue());
updateTotal.setString(2, e.getKey());
updateTotal.executeUpdate();
con.commit();
To executeUpdate, arguments are not supplied while their usage to execute updateTotals or updateSales. SQL statements are present in both PreparedStatement objects to get executed.

Submit "Executing PreparedStatement Objects" to Facebook Submit "Executing PreparedStatement Objects" to Digg Submit "Executing PreparedStatement Objects" to del.icio.us Submit "Executing PreparedStatement Objects" to StumbleUpon Submit "Executing PreparedStatement Objects" to Google

Tags: None Add / Edit Tags
Categories
JDBC

Comments