Executes the given SQL update. Resource handling is performed automatically where appropriate. @param sql the SQL to execute @return the number of rows updated or 0 for SQL statements that return nothing @throws SQLException if a database access error occurs
(String sql)
| 3331 | * @throws SQLException if a database access error occurs |
| 3332 | */ |
| 3333 | public int executeUpdate(String sql) throws SQLException { |
| 3334 | Connection connection = createConnection(); |
| 3335 | Statement statement = null; |
| 3336 | try { |
| 3337 | statement = getStatement(connection, sql); |
| 3338 | this.updateCount = statement.executeUpdate(sql); |
| 3339 | cleanup(statement); |
| 3340 | return this.updateCount; |
| 3341 | } catch (SQLException e) { |
| 3342 | LOG.warning("Failed to execute: " + sql + " because: " + e.getMessage()); |
| 3343 | throw e; |
| 3344 | } finally { |
| 3345 | closeResources(connection, statement); |
| 3346 | } |
| 3347 | } |
| 3348 | |
| 3349 | /** |
| 3350 | * Executes the given SQL update with parameters. |
no test coverage detected