Skip to content

Commit

Permalink
Back porting to 1.9.x: Using initialization wizard with db on separate
Browse files Browse the repository at this point in the history
machine - TRUNK-2765
  • Loading branch information
dkayiwa committed Feb 19, 2013
1 parent 6974111 commit 2906c95
Showing 1 changed file with 7 additions and 3 deletions.
Expand Up @@ -1328,10 +1328,14 @@ public void run() {
}

// connect via jdbc with root user and create an openmrs user
String sql = "drop user '?'@'localhost'";
String host="'%'";
if (wizardModel.databaseConnection.contains("localhost")) {
host = "'localhost'";
}
String sql = "drop user '?'@" + host;
executeStatement(true, wizardModel.createUserUsername, wizardModel.createUserPassword, sql,
connectionUsername);
sql = "create user '?'@'localhost' identified by '?'";
sql = "create user '?'@" + host + " identified by '?'";
if (-1 != executeStatement(false, wizardModel.createUserUsername,
wizardModel.createUserPassword, sql, connectionUsername, connectionPassword)) {
wizardModel.workLog.add("Created user " + connectionUsername);
Expand All @@ -1342,7 +1346,7 @@ public void run() {
}

// grant the roles
sql = "GRANT ALL ON `?`.* TO '?'@'localhost'";
sql = "GRANT ALL ON `?`.* TO '?'@" + host;
int result = executeStatement(false, wizardModel.createUserUsername,
wizardModel.createUserPassword, sql, wizardModel.databaseName, connectionUsername);
// throw the user back to the main screen if this error occurs
Expand Down

0 comments on commit 2906c95

Please sign in to comment.