提交 a97687c0 authored 作者: Thomas Mueller's avatar Thomas Mueller

CreateCluster: the property 'serverlist' is now called 'serverList'.

上级 6f23470c
...@@ -28,7 +28,7 @@ public class CreateCluster extends Tool { ...@@ -28,7 +28,7 @@ public class CreateCluster extends Tool {
" -urlTarget <url> The database URL of the target database (jdbc:h2:...)\n" + " -urlTarget <url> The database URL of the target database (jdbc:h2:...)\n" +
" -user <user> The user name\n" + " -user <user> The user name\n" +
" [-password <pwd>] The password\n" + " [-password <pwd>] The password\n" +
" -serverlist <list> The comma separated list of host names or IP addresses"); " -serverList <list> The comma separated list of host names or IP addresses");
out.println("See also http://h2database.com/javadoc/" + getClass().getName().replace('.', '/') + ".html"); out.println("See also http://h2database.com/javadoc/" + getClass().getName().replace('.', '/') + ".html");
} }
...@@ -43,7 +43,7 @@ public class CreateCluster extends Tool { ...@@ -43,7 +43,7 @@ public class CreateCluster extends Tool {
* <li>-urlTarget jdbc:h2:... (the database URL of the target database) * <li>-urlTarget jdbc:h2:... (the database URL of the target database)
* </li><li>-user (the user name) * </li><li>-user (the user name)
* </li><li>-password (the password) * </li><li>-password (the password)
* </li><li>-serverlist (the server list) * </li><li>-serverList (the server list)
* </li></ul> * </li></ul>
* *
* @param args the command line arguments * @param args the command line arguments
...@@ -58,7 +58,7 @@ public class CreateCluster extends Tool { ...@@ -58,7 +58,7 @@ public class CreateCluster extends Tool {
String urlTarget = null; String urlTarget = null;
String user = null; String user = null;
String password = ""; String password = "";
String serverlist = null; String serverList = null;
for (int i = 0; args != null && i < args.length; i++) { for (int i = 0; args != null && i < args.length; i++) {
String arg = args[i]; String arg = args[i];
if (arg.equals("-urlSource")) { if (arg.equals("-urlSource")) {
...@@ -69,8 +69,8 @@ public class CreateCluster extends Tool { ...@@ -69,8 +69,8 @@ public class CreateCluster extends Tool {
user = args[++i]; user = args[++i];
} else if (arg.equals("-password")) { } else if (arg.equals("-password")) {
password = args[++i]; password = args[++i];
} else if (arg.equals("-serverlist")) { } else if (arg.equals("-serverList")) {
serverlist = args[++i]; serverList = args[++i];
} else if (arg.equals("-help") || arg.equals("-?")) { } else if (arg.equals("-help") || arg.equals("-?")) {
showUsage(); showUsage();
return; return;
...@@ -80,11 +80,11 @@ public class CreateCluster extends Tool { ...@@ -80,11 +80,11 @@ public class CreateCluster extends Tool {
return; return;
} }
} }
if (urlSource == null || urlTarget == null || user == null || serverlist == null) { if (urlSource == null || urlTarget == null || user == null || serverList == null) {
showUsage(); showUsage();
return; return;
} }
process(urlSource, urlTarget, user, password, serverlist); process(urlSource, urlTarget, user, password, serverList);
} }
/** /**
...@@ -94,14 +94,14 @@ public class CreateCluster extends Tool { ...@@ -94,14 +94,14 @@ public class CreateCluster extends Tool {
* @param urlTarget the database URL of the copy * @param urlTarget the database URL of the copy
* @param user the user name * @param user the user name
* @param password the password * @param password the password
* @param serverlist the server list * @param serverList the server list
* @throws SQLException * @throws SQLException
*/ */
public void execute(String urlSource, String urlTarget, String user, String password, String serverlist) throws SQLException { public void execute(String urlSource, String urlTarget, String user, String password, String serverList) throws SQLException {
new CreateCluster().process(urlSource, urlTarget, user, password, serverlist); new CreateCluster().process(urlSource, urlTarget, user, password, serverList);
} }
private void process(String urlSource, String urlTarget, String user, String password, String serverlist) throws SQLException { private void process(String urlSource, String urlTarget, String user, String password, String serverList) throws SQLException {
Connection conn = null; Connection conn = null;
Statement stat = null; Statement stat = null;
try { try {
...@@ -136,14 +136,14 @@ public class CreateCluster extends Tool { ...@@ -136,14 +136,14 @@ public class CreateCluster extends Tool {
runscript.process(urlTarget, user, password, scriptFile, null, false); runscript.process(urlTarget, user, password, scriptFile, null, false);
FileUtils.delete(scriptFile); FileUtils.delete(scriptFile);
// set the cluster to the serverlist on both databases // set the cluster to the serverList on both databases
conn = DriverManager.getConnection(urlSource, user, password); conn = DriverManager.getConnection(urlSource, user, password);
stat = conn.createStatement(); stat = conn.createStatement();
stat.executeUpdate("SET CLUSTER '" + serverlist + "'"); stat.executeUpdate("SET CLUSTER '" + serverList + "'");
conn.close(); conn.close();
conn = DriverManager.getConnection(urlTarget, user, password); conn = DriverManager.getConnection(urlTarget, user, password);
stat = conn.createStatement(); stat = conn.createStatement();
stat.executeUpdate("SET CLUSTER '" + serverlist + "'"); stat.executeUpdate("SET CLUSTER '" + serverList + "'");
} finally { } finally {
JdbcUtils.closeSilently(conn); JdbcUtils.closeSilently(conn);
JdbcUtils.closeSilently(stat); JdbcUtils.closeSilently(stat);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论