- java.lang.Object
-
- org.hsqldb.cmdline.SqlTool
-
public class SqlTool extends java.lang.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SqlTool.SqlToolException
-
Field Summary
Fields Modifier and Type Field Description static int
CONNECTERR_EXITVAL
static java.lang.String
DEFAULT_RCFILE
static int
FILEERR_EXITVAL
static int
INPUTERR_EXITVAL
static int
IOERR_EXITVAL
static java.lang.String
LS
Platform-specific line separatorstatic int
RCERR_EXITVAL
static int
SQLERR_EXITVAL
static int
SQLTOOLERR_EXITVAL
static int
SYNTAXERR_EXITVAL
-
Constructor Summary
Constructors Constructor Description SqlTool()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
main(java.lang.String[] args)
A static wrapper for objectMain, so that that method may be executed as a Java "program".static void
objectMain(java.lang.String[] arg)
Connect to a JDBC Database and execute the commands given on stdin or in SQL file(s).
-
-
-
Field Detail
-
DEFAULT_RCFILE
public static final java.lang.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 final java.lang.String LS
Platform-specific line separator
-
-
Method Detail
-
main
public static void main(java.lang.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.
- Parameters:
args
- arguments- See Also:
objectMain(String[])
-
objectMain
public static void objectMain(java.lang.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.
-
-