Running ij scripts

You can run scripts in ij in any of the following ways:

Name an input file as a command-line argument. For example:java -Djdbc.drivers=org.apache.derby.jdbc.EmbeddedDriver org.apache.derby.tools.ij <myscript.sql> Redirect standard input to come from a file. For example:java -Djdbc.drivers=org.apache.derby.jdbc.EmbeddedDriver org.apache.derby.tools.ij < <myscript.sql> Use the Run command from the ij command line. For example:ij> run 'myscript.sql'; If you name an input file as a command-line argument or if you use the Run command, ij echoes input from a file. If you redirect standard input to come from a file, ij does not echo commands.

You can save output in any of the following ways:

  • By redirecting output to a file:java -Djdbc.drivers=org.apache.derby.jdbc.EmbeddedDriver org.apache.derby.tools.ij <myscript.sql> > <myoutput.txt>
  • By setting the ij.outfile property:java -Dij.outfile=<myoutput.txt> org.apache.derby.tools.ij <myscript.sql>

ij exits when you enter the Exit command or, if you give a command file on the Java invocation line, when the end of the command file is reached. When you use the Exit command, ij automatically shuts down an embedded system by issuing a connect jdbc:derby:;shutdown=true request. It does not shut down if it is running in a server framework.