private void renameTables() throws SQLException {
  try (Statement st=sqlConnection.createStatement()){
    st.addBatch("ALTER TABLE achievements RENAME TO " + tablePrefix + "achievements");
    st.addBatch("ALTER TABLE breaks RENAME TO " + tablePrefix + "breaks");
    st.addBatch("ALTER TABLE places RENAME TO " + tablePrefix + "places");
    st.addBatch("ALTER TABLE kills RENAME TO " + tablePrefix + "kills");
    st.addBatch("ALTER TABLE crafts RENAME TO " + tablePrefix + "crafts");
    st.addBatch("ALTER TABLE deaths RENAME TO " + tablePrefix + "deaths");
    st.addBatch("ALTER TABLE arrows RENAME TO " + tablePrefix + "arrows");
    st.addBatch("ALTER TABLE snowballs RENAME TO " + tablePrefix + "snowballs");
    st.addBatch("ALTER TABLE eggs RENAME TO " + tablePrefix + "eggs");
    st.addBatch("ALTER TABLE fish RENAME TO " + tablePrefix + "fish");
    st.addBatch("ALTER TABLE itembreaks RENAME TO " + tablePrefix + "itembreaks");
    st.addBatch("ALTER TABLE eatenitems RENAME TO " + tablePrefix + "eatenitems");
    st.addBatch("ALTER TABLE shears RENAME TO " + tablePrefix + "shears");
    st.addBatch("ALTER TABLE milks RENAME TO " + tablePrefix + "milks");
    st.addBatch("ALTER TABLE connections RENAME TO " + tablePrefix + "connections");
    st.addBatch("ALTER TABLE trades RENAME TO " + tablePrefix + "trades");
    st.addBatch("ALTER TABLE anvils RENAME TO " + tablePrefix + "anvils");
    st.addBatch("ALTER TABLE enchantments RENAME TO " + tablePrefix + "enchantments");
    st.addBatch("ALTER TABLE levels RENAME TO " + tablePrefix + "levels");
    st.addBatch("ALTER TABLE beds RENAME TO " + tablePrefix + "beds");
    st.addBatch("ALTER TABLE consumedpotions RENAME TO " + tablePrefix + "consumedpotions");
    st.addBatch("ALTER TABLE playedtime RENAME TO " + tablePrefix + "playedtime");
    st.addBatch("ALTER TABLE distancefoot RENAME TO " + tablePrefix + "distancefoot");
    st.addBatch("ALTER TABLE distancepig RENAME TO " + tablePrefix + "distancepig");
    st.addBatch("ALTER TABLE distancehorse RENAME TO " + tablePrefix + "distancehorse");
    st.addBatch("ALTER TABLE distanceminecart RENAME TO " + tablePrefix + "distanceminecart");
    st.addBatch("ALTER TABLE distanceboat RENAME TO " + tablePrefix + "distanceboat");
    st.addBatch("ALTER TABLE distancegliding RENAME TO " + tablePrefix + "distancegliding");
    st.addBatch("ALTER TABLE drops RENAME TO " + tablePrefix + "drops");
    st.addBatch("ALTER TABLE hoeplowing RENAME TO " + tablePrefix + "hoeplowing");
    st.addBatch("ALTER TABLE fertilising RENAME TO " + tablePrefix + "fertilising");
    st.addBatch("ALTER TABLE tames RENAME TO " + tablePrefix + "tames");
    st.addBatch("ALTER TABLE brewing RENAME TO " + tablePrefix + "brewing");
    st.addBatch("ALTER TABLE fireworks RENAME TO " + tablePrefix + "fireworks");
    st.addBatch("ALTER TABLE musicdiscs RENAME TO " + tablePrefix + "musicdiscs");
    st.addBatch("ALTER TABLE enderpearls RENAME TO " + tablePrefix + "enderpearls");
    st.executeBatch();
  }
 }

private void renameTables ( ) throws SQLException { try ( Statement st = sqlConnection . createStatement ( ) ) { st . addBatch ( "ALTER TABLE achievements RENAME TO " + tablePrefix + "achievements" ) ; st . addBatch ( "ALTER TABLE breaks RENAME TO " + tablePrefix + "breaks" ) ; st . addBatch ( "ALTER TABLE places RENAME TO " + tablePrefix + "places" ) ; st . addBatch ( "ALTER TABLE kills RENAME TO " + tablePrefix + "kills" ) ; st . addBatch ( "ALTER TABLE crafts RENAME TO " + tablePrefix + "crafts" ) ; st . addBatch ( "ALTER TABLE deaths RENAME TO " + tablePrefix + "deaths" ) ; st . addBatch ( "ALTER TABLE arrows RENAME TO " + tablePrefix + "arrows" ) ; st . addBatch ( "ALTER TABLE snowballs RENAME TO " + tablePrefix + "snowballs" ) ; st . addBatch ( "ALTER TABLE eggs RENAME TO " + tablePrefix + "eggs" ) ; st . addBatch ( "ALTER TABLE fish RENAME TO " + tablePrefix + "fish" ) ; st . addBatch ( "ALTER TABLE itembreaks RENAME TO " + tablePrefix + "itembreaks" ) ; st . addBatch ( "ALTER TABLE eatenitems RENAME TO " + tablePrefix + "eatenitems" ) ; st . addBatch ( "ALTER TABLE shears RENAME TO " + tablePrefix + "shears" ) ; st . addBatch ( "ALTER TABLE milks RENAME TO " + tablePrefix + "milks" ) ; st . addBatch ( "ALTER TABLE connections RENAME TO " + tablePrefix + "connections" ) ; st . addBatch ( "ALTER TABLE trades RENAME TO " + tablePrefix + "trades" ) ; st . addBatch ( "ALTER TABLE anvils RENAME TO " + tablePrefix + "anvils" ) ; st . addBatch ( "ALTER TABLE enchantments RENAME TO " + tablePrefix + "enchantments" ) ; st . addBatch ( "ALTER TABLE levels RENAME TO " + tablePrefix + "levels" ) ; st . addBatch ( "ALTER TABLE beds RENAME TO " + tablePrefix + "beds" ) ; st . addBatch ( "ALTER TABLE consumedpotions RENAME TO " + tablePrefix + "consumedpotions" ) ; st . addBatch ( "ALTER TABLE playedtime RENAME TO " + tablePrefix + "playedtime" ) ; st . addBatch ( "ALTER TABLE distancefoot RENAME TO " + tablePrefix + "distancefoot" ) ; st . addBatch ( "ALTER TABLE distancepig RENAME TO " + tablePrefix + "distancepig" ) ; st . addBatch ( "ALTER TABLE distancehorse RENAME TO " + tablePrefix + "distancehorse" ) ; st . addBatch ( "ALTER TABLE distanceminecart RENAME TO " + tablePrefix + "distanceminecart" ) ; st . addBatch ( "ALTER TABLE distanceboat RENAME TO " + tablePrefix + "distanceboat" ) ; st . addBatch ( "ALTER TABLE distancegliding RENAME TO " + tablePrefix + "distancegliding" ) ; st . addBatch ( "ALTER TABLE drops RENAME TO " + tablePrefix + "drops" ) ; st . addBatch ( "ALTER TABLE hoeplowing RENAME TO " + tablePrefix + "hoeplowing" ) ; st . addBatch ( "ALTER TABLE fertilising RENAME TO " + tablePrefix + "fertilising" ) ; st . addBatch ( "ALTER TABLE tames RENAME TO " + tablePrefix + "tames" ) ; st . addBatch ( "ALTER TABLE brewing RENAME TO " + tablePrefix + "brewing" ) ; st . addBatch ( "ALTER TABLE fireworks RENAME TO " + tablePrefix + "fireworks" ) ; st . addBatch ( "ALTER TABLE musicdiscs RENAME TO " + tablePrefix + "musicdiscs" ) ; st . addBatch ( "ALTER TABLE enderpearls RENAME TO " + tablePrefix + "enderpearls" ) ; st . executeBatch ( ) ; } }
rename the database tables with the prefix given in the configuration file . this method is only used and only works if the tables had the default name . it does not support multiple successive table renamings .
