Module org.apache.derby.tools
Package org.apache.derby.tools

## Class ij

- java.lang.Object
- - org.apache.derby.tools.ij

-     public class ij
      extends Object

  ij is Derby's interactive JDBC scripting tool. It is a simple utility for running scripts against a Derby database. You can also use it interactively to run ad hoc queries. ij provides several commands for ease in accessing a variety of JDBC features.

  To run from the command line enter the following:

  java [options] org.apache.derby.tools.ij [arguments]

  ij is can also be used with any database server that supports a JDBC driver.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static String` | `getArg​(String param, String[] args)` |
    `static void` | `getPropertyArg​(String[] args)` |
    `static void` | `main​(String[] args)` |
    `static int` | `runScript​(Connection conn, InputStream sqlIn, String inputEncoding, OutputStream sqlOut, String outputEncoding)` | Run a SQL script from an InputStream and write the resulting output to the provided PrintStream.
    `static int` | `runScript​(Connection conn, InputStream sqlIn, String inputEncoding, OutputStream sqlOut, String outputEncoding, boolean loadSystemProperties)` | Run a SQL script from an InputStream and write the resulting output to the provided PrintStream.
    `static Connection` | `startJBMS()` |

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### main

          public static void main​(String[] args)
                           throws IOException

      Throws:
        `IOException` - thrown if cannot access input or output files.

    - #### runScript

          public static int runScript​(Connection conn,
                                      InputStream sqlIn,
                                      String inputEncoding,
                                      OutputStream sqlOut,
                                      String outputEncoding)
                               throws UnsupportedEncodingException

      Run a SQL script from an InputStream and write the resulting output to the provided PrintStream. SQL commands are separated by a semi-colon ';' character.
      Parameters:
        `conn` - Connection to be used as the script's default connection.
        `sqlIn` - InputStream for the script.
        `inputEncoding` - Encoding of the script.
        `sqlOut` - OutputStream for the script's output
        `outputEncoding` - Output encoding to use.
      Returns:
        Number of SQLExceptions thrown during the execution, -1 if not known.
      Throws:
        `UnsupportedEncodingException`

    - #### runScript

          public static int runScript​(Connection conn,
                                      InputStream sqlIn,
                                      String inputEncoding,
                                      OutputStream sqlOut,
                                      String outputEncoding,
                                      boolean loadSystemProperties)
                               throws UnsupportedEncodingException

      Run a SQL script from an InputStream and write the resulting output to the provided PrintStream. SQL commands are separated by a semi-colon ';' character.
      Parameters:
        `conn` - Connection to be used as the script's default connection.
        `sqlIn` - InputStream for the script.
        `inputEncoding` - Encoding of the script.
        `sqlOut` - OutputStream for the script's output
        `outputEncoding` - Output encoding to use.
        `loadSystemProperties` - Whether to use the system properties.
      Returns:
        Number of SQLExceptions thrown during the execution, -1 if not known.
      Throws:
        `UnsupportedEncodingException`

    - #### getArg

          public static String getArg​(String param,
                                      String[] args)

    - #### getPropertyArg

          public static void getPropertyArg​(String[] args)
                                     throws IOException

      Throws:
        `IOException`

    - #### startJBMS

          public static Connection startJBMS()
                                      throws SQLException,
                                             IllegalAccessException,
                                             ClassNotFoundException,
                                             InstantiationException,
                                             NoSuchMethodException,
                                             InvocationTargetException

      Throws:
        `SQLException`
        `IllegalAccessException`
        `ClassNotFoundException`
        `InstantiationException`
        `NoSuchMethodException`
        `InvocationTargetException`