Closed Normynator closed 9 years ago
public void renameDatabase(String newName) throws SQLException { connect.createStatement().executeUpdate("CREATE DATABASE " + newName); for(Table lst : getTable()){ System.out.println(lst.getName()); connect.createStatement().executeUpdate("RENAME TABLE " + dbname + "." + lst.getName()+ " TO " + newName + "." + lst.getName()); } connect.createStatement().executeUpdate("DROP DATABASE " + dbname); dbname = newName; }
Wird ein Reload benötigt, da die neue Datenbank nicht angezeigt wird.
public void renameDatabase(String newName) throws SQLException { connect.createStatement().executeUpdate("CREATE DATABASE " + newName); for(Table lst : getTable()){ System.out.println(lst.getName()); connect.createStatement().executeUpdate("RENAME TABLE " + dbname + "." + lst.getName()+ " TO " + newName + "." + lst.getName()); } connect.createStatement().executeUpdate("DROP DATABASE " + dbname); dbname = newName; }