Java Utililty Methods SQL Table Drop

List of utility methods to do SQL Table Drop

Description

The list of methods to do SQL Table Drop are organized into topic(s).

Method

booleandelete(Connection conn, String table, Serializable id)
delete
int ret = 0;
try {
    Statement statement = conn.createStatement();
    String sql = String.format("DELETE FROM %s WHERE id = %s;", table, id);
    ret = statement.executeUpdate(sql);
    statement.close();
} catch (SQLException e) {
    e.printStackTrace();
...
voiddeleteMySqlTable(String tableName, Statement stmt)
delete My Sql Table
stmt.executeUpdate("TRUNCATE " + tableName);
voiddeleteTable(Connection con, String tableName)
delete Table
Statement stmt = null;
try {
    stmt = con.createStatement();
    stmt.executeUpdate("delete " + tableName);
} finally {
    if (stmt != null) {
        stmt.close();
voiddropTable(Connection con, String table)
drop Table
Statement stmt = con.createStatement();
try {
    String sql = "DROP TABLE " + table + " CASCADE ";
    stmt.executeUpdate(sql);
} catch (SQLException ex) {
    if (!con.getAutoCommit()) {
        throw ex;
voiddropTable(Connection con, String tableName)
Drop d'une table.
Statement stmt = null;
try {
    stmt = con.createStatement();
    stmt.executeUpdate("drop table " + tableName);
} catch (SQLException ex) {
    ; 
} finally {
    if (stmt != null) {
...
voiddropTable(Connection conn, String table)
drop Table
Statement stmt = null;
try {
    stmt = conn.createStatement();
    stmt.executeUpdate("drop table " + table);
} catch (SQLException e) {
    Logger.global.log(Level.FINE, "Drop table failed for = " + table);
    Logger.global.log(Level.FINE, "==============\n\n");
} finally {
...
voiddropTable(Connection conn, String tablename)
drop Table
StringBuilder sb = new StringBuilder();
sb.append("DROP TABLE IF EXISTS ");
sb.append(tablename);
String sql = sb.toString();
Statement stmt = null;
try {
    stmt = conn.createStatement();
    stmt.executeUpdate(sql);
...
voiddropTable(Connection conn, String tableName)
drop Table
executeStatement(conn, String.format("DROP TABLE IF EXISTS %s", tableName));
voiddropTable(Connection connection)
drop Table
Statement statement = connection.createStatement();
statement.execute(DROP_TABLE_QUERY);
voiddropTable(Connection connection)
drop Table
try (Statement statement = connection.createStatement()) {
    statement.execute("drop table METRICS_TEST");