Here you can find the source of dropTable(String tableName, Connection con)
public static void dropTable(String tableName, Connection con) throws SQLException
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class Main { public static void dropTable(String tableName, Connection con) throws SQLException { tableName = normalizeTableName(tableName, con); con.createStatement().execute("drop table " + tableName); }/*w w w . ja v a 2 s .c o m*/ public static String normalizeTableName(String table, Connection con) throws SQLException { for (String t : getTables(con)) { if (t.equalsIgnoreCase(table)) { return t; } } return table; } public static List<String> getTables(Connection con) throws SQLException { String[] types = { "TABLE" }; ResultSet rs = con.getMetaData().getTables(null, null, "%", types); List<String> tables = new ArrayList<String>(); while (rs.next()) { tables.add(rs.getString("TABLE_NAME")); } rs.close(); return tables; } }