String filename = jtextfieldDatabaseDirectory.getText().trim() +
"/" + jtextfieldFilename.getText();
File file = new File(filename);
FBManager fbManager = new FBManager();
fbManager.setServer(jtextfieldServer.getText());
fbManager.setPort(Integer.parseInt(jtextfieldPort.getText()));
if (file.exists()) {
String msg = i18n.CREATEDB_MSG_FILEEXISTS.replaceAll("{0}", filename);
if (JOptionPane.showConfirmDialog(_application.getMainFrame(), msg,
i18n.CREATEDB_MSG_WARNING, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
fbManager.setForceCreate(true);
else {
JOptionPane.showMessageDialog(_application.getMainFrame(), i18n.CREATEDB_MSG_CANCELED);
return;
}
}
// set dialog
FBMaintenanceManager mm = new FBMaintenanceManager();
try {
int sqlDialect = radioButtonDialect1.isSelected() ? 1 : 3;
mm.setDatabaseDialect(sqlDialect);
} catch (SQLException e) {
log.error(e.getLocalizedMessage());
}
try {
fbManager.start();
fbManager.createDatabase(filename,
jtextfieldUsername.getText(), new String(jpasswordfield.getPassword()));
fbManager.stop();
JOptionPane.showMessageDialog(_application.getMainFrame(), i18n.CREATEDB_MSG_SUCCEDED);
saveSessionPreferences();
} catch (Exception e) {
JOptionPane.showMessageDialog(_application.getMainFrame(), i18n.CREATEDB_MSG_FAILED