Code example for Connection

Methods: commitcreateStatement

0
   */ 
  protected void executeSQL(String sqlStmt)
  { 
    try 
    { 
      Statement statement = conx.createStatement();
 
      statement.executeUpdate(sqlStmt);
      statement.close();
 
      conx.commit();
    } 
    catch (SQLException ex)
    { 
      String error = ex.getMessage() + " - SQL Statement That caused the error: [" + sqlStmt + ']';
      throw new DatabaseException(error, ex, sqlStmt);
    } 
    finally 
    { 
      this.close();
    } 
  } 
 
  /** 
   * Closes the connection to the database. 
   */ 
  public void close() 
  { 
    try 
    { 
      Database.closeConnection(conx);
    } 
    catch (SQLException ex)
    { 
      Database.throwDatabaseException(ex);
    } 
Experience pair programming with AI  Get Codota for Java