Package org.apache.derby.tools
Class ij
- java.lang.Object
-
- org.apache.derby.tools.ij
-
public class ij extends java.lang.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.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ij()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getArg(java.lang.String param, java.lang.String[] args)
static void
getPropertyArg(java.lang.String[] args)
static void
main(java.lang.String[] args)
static int
runScript(java.sql.Connection conn, java.io.InputStream sqlIn, java.lang.String inputEncoding, java.io.OutputStream sqlOut, java.lang.String outputEncoding)
Run a SQL script from an InputStream and write the resulting output to the provided PrintStream.static int
runScript(java.sql.Connection conn, java.io.InputStream sqlIn, java.lang.String inputEncoding, java.io.OutputStream sqlOut, java.lang.String outputEncoding, boolean loadSystemProperties)
Run a SQL script from an InputStream and write the resulting output to the provided PrintStream.static java.sql.Connection
startJBMS()
-
-
-
Method Detail
-
main
public static void main(java.lang.String[] args) throws java.io.IOException
- Throws:
java.io.IOException
- thrown if cannot access input or output files.
-
runScript
public static int runScript(java.sql.Connection conn, java.io.InputStream sqlIn, java.lang.String inputEncoding, java.io.OutputStream sqlOut, java.lang.String outputEncoding) throws java.io.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 outputoutputEncoding
- Output encoding to use.- Returns:
- Number of SQLExceptions thrown during the execution, -1 if not known.
- Throws:
java.io.UnsupportedEncodingException
-
runScript
public static int runScript(java.sql.Connection conn, java.io.InputStream sqlIn, java.lang.String inputEncoding, java.io.OutputStream sqlOut, java.lang.String outputEncoding, boolean loadSystemProperties) throws java.io.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 outputoutputEncoding
- Output encoding to use.loadSystemProperties
- Whether to use the system properties.- Returns:
- Number of SQLExceptions thrown during the execution, -1 if not known.
- Throws:
java.io.UnsupportedEncodingException
-
getArg
public static java.lang.String getArg(java.lang.String param, java.lang.String[] args)
-
getPropertyArg
public static void getPropertyArg(java.lang.String[] args) throws java.io.IOException
- Throws:
java.io.IOException
-
startJBMS
public static java.sql.Connection startJBMS() throws java.sql.SQLException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException
- Throws:
java.sql.SQLException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException
-
-