private static LogImpl getLogImpl(JDBCConfiguration conf) {
return (LogImpl)conf.getLog(JDBCConfiguration.LOG_SCHEMA);
}
private static void immediateDropDB(ConnectionProperties props) throws Exception {
JDBCConfigurationImpl conf = new JDBCConfigurationImpl();
try {
conf.setPropertiesFile(new File(OmFileHelper.getWebinfDir(), PERSISTENCE_NAME));
conf.setConnectionDriverName(props.getDriver());
conf.setConnectionURL(props.getURL());
conf.setConnectionUserName(props.getLogin());
conf.setConnectionPassword(props.getPassword());
//HACK to suppress all warnings
getLogImpl(conf).setLevel(Log.INFO);
SchemaTool st = new SchemaTool(conf, SchemaTool.ACTION_DROPDB);
st.setIgnoreErrors(true);
st.setOpenJPATables(true);
st.setIndexes(false);
st.setPrimaryKeys(false);
st.run();
} finally {
conf.close();
}
}