java.lang.Object
org.apache.derby.tools.ij
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
Modifier and TypeMethodDescriptionstatic String
static void
getPropertyArg
(String[] args) static void
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
-
Method Details
-
main
- 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 outputoutputEncoding
- 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 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:
UnsupportedEncodingException
-
getArg
-
getPropertyArg
- Throws:
IOException
-
startJBMS
public static Connection startJBMS() throws SQLException, IllegalAccessException, ClassNotFoundException, InstantiationException, NoSuchMethodException, InvocationTargetException
-