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

The API of the tools changed a bit.

上级 20037a4a
...@@ -2,6 +2,8 @@ org.h2.tools.Backup=Creates a backup of a database. ...@@ -2,6 +2,8 @@ org.h2.tools.Backup=Creates a backup of a database.
org.h2.tools.Backup.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-file <filename>] The target file name (default\: backup.zip)\n[-dir <dir>] The source directory (default\: .)\n[-db <database>] Source database; not required if there is only one\n[-quiet] Do not print progress information org.h2.tools.Backup.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-file <filename>] The target file name (default\: backup.zip)\n[-dir <dir>] The source directory (default\: .)\n[-db <database>] Source database; not required if there is only one\n[-quiet] Do not print progress information
org.h2.tools.ChangeFileEncryption=Allows changing the database file encryption password or algorithm.\nThis tool can not be used to change a password of a user. org.h2.tools.ChangeFileEncryption=Allows changing the database file encryption password or algorithm.\nThis tool can not be used to change a password of a user.
org.h2.tools.ChangeFileEncryption.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-cipher type] The encryption type (AES or XTEA)\n[-dir <dir>] The database directory (default\: .)\n[-db <database>] Database name (all databases if not set)\n[-decrypt <pwd>] The decryption password (if not set\: not yet encrypted)\n[-encrypt <pwd>] The encryption password (if not set\: do not encrypt)\n[-quiet] Do not print progress information org.h2.tools.ChangeFileEncryption.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-cipher type] The encryption type (AES or XTEA)\n[-dir <dir>] The database directory (default\: .)\n[-db <database>] Database name (all databases if not set)\n[-decrypt <pwd>] The decryption password (if not set\: not yet encrypted)\n[-encrypt <pwd>] The encryption password (if not set\: do not encrypt)\n[-quiet] Do not print progress information
org.h2.tools.Console=Starts the H2 Console (web-) server, as well as the TCP and PG server.
org.h2.tools.Console.main=When running without options, -tcp, -web, -browser and -pg are started.\nOptions are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-web] Start the web server with the H2 Console\n[-tool] Start the icon or window that allows to start a browser\n[-browser] Start a browser and open a page to connect to the web server\n[-tcp] Start the TCP server\n[-pg] Start the PG server\nFor each Server, additional options are available; for details, see the Server tool.\nIf a service can not be started, the program terminates with an exit code of 1.
org.h2.tools.ConvertTraceFile=Converts a .trace.db file to a SQL script and Java source code.\nSQL statement statistics are listed as well. org.h2.tools.ConvertTraceFile=Converts a .trace.db file to a SQL script and Java source code.\nSQL statement statistics are listed as well.
org.h2.tools.ConvertTraceFile.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-traceFile <file>] The trace file name (default\: test.trace.db)\n[-script <file>] The script file name (default\: test.sql)\n[-javaClass <file>] The Java directory and class file name (default\: Test) org.h2.tools.ConvertTraceFile.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-traceFile <file>] The trace file name (default\: test.trace.db)\n[-script <file>] The script file name (default\: test.sql)\n[-javaClass <file>] The Java directory and class file name (default\: Test)
org.h2.tools.CreateCluster=Creates a cluster from a standalone database.\nCopies a database to another location if required. org.h2.tools.CreateCluster=Creates a cluster from a standalone database.\nCopies a database to another location if required.
...@@ -16,3 +18,7 @@ org.h2.tools.RunScript=Runs a SQL script against a database. ...@@ -16,3 +18,7 @@ org.h2.tools.RunScript=Runs a SQL script against a database.
org.h2.tools.RunScript.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-url <url>] The database URL (jdbc\:...)\n[-user <user>] The user name (default\: sa)\n[-password <pwd>] The password\n[-script <file>] The script file to run (default\: backup.sql)\n[-driver <class>] The JDBC driver class to use (not required in most cases)\n[-showResults] Show the statements and the results of queries\n[-checkResults] Check if the query results match the expected results\n[-options ...] A list of options (only for embedded H2, see RUNSCRIPT) org.h2.tools.RunScript.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-url <url>] The database URL (jdbc\:...)\n[-user <user>] The user name (default\: sa)\n[-password <pwd>] The password\n[-script <file>] The script file to run (default\: backup.sql)\n[-driver <class>] The JDBC driver class to use (not required in most cases)\n[-showResults] Show the statements and the results of queries\n[-checkResults] Check if the query results match the expected results\n[-options ...] A list of options (only for embedded H2, see RUNSCRIPT)
org.h2.tools.Script=Creates a SQL script file by extracting the schema and data of a database. org.h2.tools.Script=Creates a SQL script file by extracting the schema and data of a database.
org.h2.tools.Script.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-url <url>] The database URL (jdbc\:...)\n[-user <user>] The user name (default\: sa)\n[-password <pwd>] The password\n[-script <file>] The target script file name (default\: backup.sql)\n[-options ...] A list of options (only for embedded H2, see RUNSCRIPT)\n[-quiet] Do not print progress information org.h2.tools.Script.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-url <url>] The database URL (jdbc\:...)\n[-user <user>] The user name (default\: sa)\n[-password <pwd>] The password\n[-script <file>] The target script file name (default\: backup.sql)\n[-options ...] A list of options (only for embedded H2, see RUNSCRIPT)\n[-quiet] Do not print progress information
org.h2.tools.Server=Starts the H2 Console (web-) server, TCP, PG, and FTP server.
org.h2.tools.Server.main=When running without options, -tcp, -web, -browser and -pg are started.\nOptions are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-web] Start the web server with the H2 Console\n[-webAllowOthers] Allow other computers to connect\n[-webPort <port>] The port (default\: 8082)\n[-webSSL] Use encrypted (HTTPS) connections\n[-browser] Start a browser and open a page to connect to the web server\n[-tcp] Start the TCP server\n[-tcpAllowOthers] Allow other computers to connect\n[-tcpPort <port>] The port (default\: 9092)\n[-tcpSSL] Use encrypted (SSL) connections\n[-tcpPassword <pwd>] The password for shutting down a TCP server\n[-tcpShutdown <url>] Stop the TCP server; example\: tcp\://localhost\:9094\n[-tcpShutdownForce] Do not wait until all connections are closed\n[-pg] Start the PG server\n[-pgAllowOthers] Allow other computers to connect\n[-pgPort <port>] The port (default\: 5435)\n[-ftp] Start the FTP server\n[-ftpPort <port>] The port (default\: 8021)\n[-ftpDir <dir>] The base directory (default\: ftp)\n[-ftpRead <user>] The user name for reading (default\: guest)\n[-ftpWrite <user>] The user name for writing (default\: sa)\n[-ftpWritePassword <p>] The write password (default\: sa)\n[-baseDir <dir>] The base directory for H2 databases; for all servers\n[-ifExists] Only existing databases may be opened; for all servers\n[-trace] Print additional trace information; for all servers
org.h2.tools.Shell=Interactive command line tool to access a database using JDBC.
org.h2.tools.Shell.main=Options are case sensitive. Supported options are\:\n[-help] or [-?] Print the list of options\n[-url <url>] The database URL (jdbc\:h2\:...)\n[-user <user>] The user name\n[-password <pwd>] The password\n[-driver <class>] The JDBC driver class to use (not required in most cases)
...@@ -44,13 +44,9 @@ import org.h2.util.Tool; ...@@ -44,13 +44,9 @@ import org.h2.util.Tool;
*/ */
public class TcpServer implements Service { public class TcpServer implements Service {
// TODO new feature: implement automatic client / server mode if 'socket'
// file locking is used
// TODO better exception message if the port is already in use, maybe
// automatically use the next free port?
/** /**
* The default port to use for the TCP server. * The default port to use for the TCP server.
* This value is also in the documentation and in the Server javadoc.
*/ */
public static final int DEFAULT_PORT = 9092; public static final int DEFAULT_PORT = 9092;
......
...@@ -35,7 +35,10 @@ import org.h2.util.Tool; ...@@ -35,7 +35,10 @@ import org.h2.util.Tool;
*/ */
public class PgServer implements Service { public class PgServer implements Service {
// also in the docs /**
* The default port to use for the PG server.
* This value is also in the documentation and in the Server javadoc.
*/
public static final int DEFAULT_PORT = 5435; public static final int DEFAULT_PORT = 5435;
private int port = PgServer.DEFAULT_PORT; private int port = PgServer.DEFAULT_PORT;
......
...@@ -42,6 +42,11 @@ public abstract class Tool { ...@@ -42,6 +42,11 @@ public abstract class Tool {
*/ */
public abstract void run(String[] args) throws SQLException; public abstract void run(String[] args) throws SQLException;
protected SQLException throwUnsupportedOption(String option) throws SQLException {
showUsage();
throw new SQLException("Unsupported option: " + option);
}
/** /**
* Print to the output stream that no database files have been found. * Print to the output stream that no database files have been found.
* *
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论