org.h2.tools
Class Shell

java.lang.Object
  extended by org.h2.util.Tool
      extended by org.h2.tools.Shell

public class Shell
extends Tool

Interactive command line tool to access a database using JDBC.

H2.resource:

Field Summary
 
Fields inherited from class org.h2.util.Tool
out
 
Constructor Summary
Shell()
           
 
Method Summary
static void main(java.lang.String... args)
          Options are case sensitive.
protected  void print(java.lang.String s)
          Print the string without newline, and flush.
 void run(java.lang.String... args)
          Run the shell tool with the given command line settings.
 void setErr(java.io.PrintStream err)
          Sets the standard error stream.
 void setIn(java.io.InputStream in)
          Redirects the standard input.
 void setInReader(java.io.BufferedReader reader)
          Redirects the standard input.
 
Methods inherited from class org.h2.util.Tool
printNoDatabaseFilesFound, readArgBoolean, setOut, showUsage, throwUnsupportedOption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shell

public Shell()
Method Detail

main

public static void main(java.lang.String... args)
                 throws java.sql.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)
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
Throws:
java.sql.SQLException
H2.resource:

setErr

public void setErr(java.io.PrintStream err)
Sets the standard error stream.

Parameters:
err - the new standard error stream

setIn

public void setIn(java.io.InputStream in)
Redirects the standard input. By default, System.in is used.

Parameters:
in - the input stream to use

setInReader

public void setInReader(java.io.BufferedReader reader)
Redirects the standard input. By default, System.in is used.

Parameters:
reader - the input stream reader to use

run

public void run(java.lang.String... args)
         throws java.sql.SQLException
Run the shell tool with the given command line settings.

Specified by:
run in class Tool
Parameters:
args - the command line settings
Throws:
java.sql.SQLException

print

protected void print(java.lang.String s)
Print the string without newline, and flush.

Parameters:
s - the string to print