db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Bradbury <Stan.Bradb...@gmail.com>
Subject Re: IJ scripting - parameters or variables?
Date Mon, 30 Apr 2007 17:16:53 GMT
Bryan Pendleton wrote:
>> Is there any way to pass in variables to ij SQL scripts or define local
>> variables?  If not do you have to manually 'hard code' everything in
>> your scripts?
>
> Since IJ scripts are, in the end, just text files, it seems
> like you could use pretty much any scripting language to
> construct your scripts with parameter substitution, then feed
> the results into IJ.
>
> For example, you might investigate Ruby, which is a great scripting 
> language.
>
> thanks,
>
> bryan
>
>
>
Hi Derick -

I believe that what you need can be done by specifying database install 
information on the IJ command line.  This is how I setup my install 
scripts.  If the installation is complex you can wrap the commands in an 
OS script like Bryan suggests or just document the command (gets pretty 
long)  that needs to be typed by the person performing the install.  The 
scripts that IJ reads can only contain IJ commands and standard SQL 
commands, there is no programming API for IJ - Java is the Derby API and 
can do everything IJ can and more.  Here is an example of the IJ command 
line that uses variables to create a DB and specify the install 
information the reads the SQL script 'doDbSetup.sql' and saves the 
output/messages in doDbSetup.log.

 -- variables
DBNAME=MyDB
INSTALLDIR=/usr/derby/databases
DBOPTIONS=;create=true;dataEncryption=true;bootPassword=clo760uds2caPe

-- command line
java -Dij.protocol=jdbc:derby:  
-Dij.database=$INSTALLDIR/$DBNAME$DBOPTIONS org.apache.derby.tools.ij 
<   doDbSetup.sql   >> doDbSetup.log



Mime
View raw message