How to execute an SQL script for Derby DB from a ksh script
You can accomplish this by redirecting stdin to the ij tool and running it using java:
Name an input file as a command-line argument. For example:
java org.apache.derby.tools.ij myscript.sql
Redirect standard input to come from a file. For example:
java org.apache.derby.tools.ij < myscript.sql
Source: Derby documentation