Java SQL Table Drop dropTable(Connection con, String tableName)

Here you can find the source of dropTable(Connection con, String tableName)

Description

Drop d'une table.

License

Apache License

Parameter

Parameter Description
con la connection
tableName La table

Exception

Parameter Description
SQLException Erreur SQL

Declaration

@Deprecated
public static void dropTable(Connection con, String tableName) throws SQLException 

Method Source Code


//package com.java2s;
/*//from   w w  w  .  j  a va  2 s. c o m
 * codjo.net
 *
 * Common Apache License 2.0
 */

import java.sql.Connection;

import java.sql.SQLException;
import java.sql.Statement;

public class Main {

    @Deprecated
    public static void dropTable(Connection con, String tableName) throws SQLException {
        Statement stmt = null;
        try {
            stmt = con.createStatement();
            stmt.executeUpdate("drop table " + tableName);
        } catch (SQLException ex) {
            ; // si la table n'existe pas...
        } finally {
            if (stmt != null) {
                stmt.close();
            }
        }
    }
}

Related

  1. delete(Connection conn, String table, Serializable id)
  2. deleteMySqlTable(String tableName, Statement stmt)
  3. deleteTable(Connection con, String tableName)
  4. dropTable(Connection con, String table)
  5. dropTable(Connection conn, String table)
  6. dropTable(Connection conn, String tablename)
  7. dropTable(Connection conn, String tableName)
  8. dropTable(Connection connection)