## org.hsqldb.cmdline
Class SqlTool

    java.lang.Object
      org.hsqldb.cmdline.SqlTool

    public class SqlTool

extends Object

A command-line JDBC SQL tool supporting both interactive and non-interactive usage.

See JavaDocs for the main method for syntax of how to run from the command-line.

Programmatic users will usually want to use the objectMain(String[]) method if they want arguments and behavior exactly like command-line SqlTool. But in many cases, you will have better control and efficiency by using the SqlFile class directly. The file `src/org/hsqldb/sample/SqlFileEmbedder.java` in the HSQLDB distribution provides an example for this latter strategy.

Author:
  Blaine Simpson (blaine dot simpson at admc dot com)
See Also:
  The SqlTool chapter of the HyperSQL Utilities Guide, `main(String[])`, `objectMain(String[])`, `SqlFile`, `SqlFileEmbedder`

Nested Class Summary
`static class` `SqlTool.SqlToolException`

Field Summary
`static int` `CONNECTERR_EXITVAL`
`static String` `DEFAULT_RCFILE`
`static int` `FILEERR_EXITVAL`
`static int` `INPUTERR_EXITVAL`
`static int` `IOERR_EXITVAL`
`static String` `LS` Platform-specific line separator
`static int` `RCERR_EXITVAL`
`static int` `SQLERR_EXITVAL`
`static int` `SQLTOOLERR_EXITVAL`
`static int` `SYNTAXERR_EXITVAL`

Constructor Summary
`SqlTool()`

Method Summary
`static void` `main(String[] args)` A static wrapper for objectMain, so that that method may be executed as a Java "program".
`static void` `objectMain(String[] arg)` Connect to a JDBC Database and execute the commands given on stdin or in SQL file(s).

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_RCFILE

    public static final String DEFAULT_RCFILE

### SQLTOOLERR_EXITVAL

    public static final int SQLTOOLERR_EXITVAL

See Also:
  Constant Field Values

### SYNTAXERR_EXITVAL

    public static final int SYNTAXERR_EXITVAL

See Also:
  Constant Field Values

### RCERR_EXITVAL

    public static final int RCERR_EXITVAL

See Also:
  Constant Field Values

### SQLERR_EXITVAL

    public static final int SQLERR_EXITVAL

See Also:
  Constant Field Values

### IOERR_EXITVAL

    public static final int IOERR_EXITVAL

See Also:
  Constant Field Values

### FILEERR_EXITVAL

    public static final int FILEERR_EXITVAL

See Also:
  Constant Field Values

### INPUTERR_EXITVAL

    public static final int INPUTERR_EXITVAL

See Also:
  Constant Field Values

### CONNECTERR_EXITVAL

    public static final int CONNECTERR_EXITVAL

See Also:
  Constant Field Values

### LS

    public static String LS

  Platform-specific line separator

Constructor Detail

### SqlTool

    public SqlTool()

Method Detail

### main

    public static void main(String[] args)

  A static wrapper for objectMain, so that that method may be executed as a Java "program".

  Throws only RuntimeExceptions or Errors, because this method is intended to System.exit() for all but disastrous system problems, for which the inconvenience of a stack trace would be the least of your worries.

  If you don't want SqlTool to System.exit(), then use the method objectMain() instead of this method.

  See Also:
    `objectMain(String[])`

### objectMain

    public static void objectMain(String[] arg)
                           throws SqlTool.SqlToolException

  Connect to a JDBC Database and execute the commands given on stdin or in SQL file(s).

  This method is changed for HSQLDB 1.8.0.8 and later to never System.exit(). Developers may catch Throwables to handle all fatal situations.

  Parameters:
    `arg` - Run "java... org.hsqldb.cmdline.SqlTool --help" for syntax.
  Throws:
    `SqlTool.SqlToolException` - Upon any fatal error, with useful reason as the exception's message.

Copyright © 2001 - 2010 HSQL Development Group.