apache > db
Apache DB Project
 
Font size:      

Running ij scripts

Running ij scripts

You can run scripts in ij in a few different ways:

  • You 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
    
    
  • You can 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
    
    
  • You can use the Run command from the ij command line. For example:
    ij> run 'myscript.sql';
    
    

ij echoes input from a file if

  • you name an input file as a command-line argument
  • you use the Run command

If you redirect standard input to come from a file, ij does not echo commands.

You can save output by redirecting output to a file or by setting the ij.outfile property. (See ij.outfile.) For example:

java -Djdbc.drivers=org.apache.derby.jdbc.EmbeddedDriver
    org.apache.derby.tools.ij < myscript.sql > myoutput.txt
 
java -Dij.outfile=myoutput.txt org.apache.derby.tools.ij 
    < myscript.sql

ij automatically shuts down an embedded Derby system (issues a connect 'jdbc:derby:;shutdown=true' request) when the Exit command is issued. It does not shut down Derby running in a server framework.

ij exits when the Exit command is entered or if given a command file on the Java invocation line, when the end of the command file is reached.


Previous Page
Next Page
Table of Contents
Index