# Shell

Interactive command line tool to access a database using JDBC.

Methods
static void | main(String... args) Options are case sensitive.

static void

main(String... args) throws SQLException
Options are case sensitive. Supported options are:

[-help] or [-?] | Print the list of options
[-url "<url>"] | The database URL (jdbc:h2:...)
[-user <user>] | The user name
[-password <pwd>] | The password
[-driver <class>] | The JDBC driver class to use (not required in most cases)
[-sql "<statements>"] | Execute the SQL statements and exit
[-properties "<dir>"] | Load the server properties from this directory

If special characters don't work as expected, you may need to use -Dfile.encoding=UTF-8 (Mac OS X) or CP850 (Windows).
Parameters:
args - the command line arguments

void | print(String s) Print the string without newline, and flush.
void | print(String s) Print the string without newline, and flush. Parameters: s - the string to print
void | runTool(String... args) Run the shell tool with the given command line settings.
void | runTool(String... args) throws SQLException Run the shell tool with the given command line settings. Parameters: args - the command line settings
void | runTool(Connection conn, String... args) Run the shell tool with the given connection and command line settings.

void

runTool(Connection conn, String... args) throws SQLException
Run the shell tool with the given connection and command line settings. The connection will be closed when the shell exits. This is primary used to integrate the Shell into another application.

Note: using the "-url" option in {@code args} doesn't make much sense since it will override the {@code conn} parameter.

Parameters:
conn - the connection
args - the command line settings

void | setErr(PrintStream err) Sets the standard error stream.
void | setErr(PrintStream err) Sets the standard error stream. Parameters: err - the new standard error stream
void | setIn(InputStream in) Redirects the standard input.
void | setIn(InputStream in) Redirects the standard input. By default, System.in is used. Parameters: in - the input stream to use
void | setInReader(BufferedReader reader) Redirects the standard input.
void | setInReader(BufferedReader reader) Redirects the standard input. By default, System.in is used. Parameters: reader - the input stream reader to use