Installing/Executing Sqlch

Sqlch comes with several jars that must be added to your CLASSPATH before Sqlch will work. Jar files that Sqlch requires are listed on the versions page. Sqlch itself exists in a sqlch.jar and one or more database-specific jars (currently only sqlch_oracle.jar) that you only need to include if you are using that database.

Finally, Sqlch also has a dependency on some classes provided by Ant. These classes can be found in the ant.jar file (in Ant 1.6.1).

Configuring your environment to use the Sqlch API or Sqlch tools.

To use Sqlch, set your classpath appropriately (as mentioned above).

If you are using the Sqlch command line tools, the JDBC driver you intend to use must be on your classpath.

For instance, you might a batch file containing the following lines for Microsoft Windows to set up your environment for Sqlch:

REM Change SQLCH_HOME to point to your Sqlch directory
set SQLCH_HOME=c:\sqlch

REM Change ANT_HOME to point to your Ant directory
set ANT_HOME=c:\apache-ant-1.6.1

REM Add the JARs that Sqlch depends on
set CLASSPATH=%CLASSPATH%;%SQLCH_HOME%\lib\commons-codec-1.2.jar;%SQLCH_HOME%\lib\xml-apis.jar;%SQLCH_HOME%\lib\xercesImpl.jar

REM Add the Ant JARs required by Sqlch (not necessary if you are using Sqlch
REM within Ant)
set CLASSPATH=%CLASSPATH%;%ANT_HOME%\lib\ant.jar

REM Add the Sqlch jars (change as appropriate for your database)
set CLASSPATH=%CLASSPATH%;%SQLCH_HOME%\build\sqlch.jar;%SQLCH_HOME%\build\sqlch_oracle.jar

REM Add the JDBC driver to the CLASSPATH (not required if you are using Ant and
REM use the driverClasspath attribute of dbexecute)
set CLASSPATH=%CLASSPATH%;{...path to your JDBC driver...}

Using Sqlch with Ant

In order to use Sqlch with Ant you'll need to add the necessary JARs to the Ant classpath. Depending on the version of Ant, you can do this in a number of ways. One way is simply to set your CLASSPATH variable appropriately (e.g. as in the example above).

If you are using the dbexecute Ant task, Sqlch does not require that the JDBC driver you intend to use is in the classpath - you can specify the location of the driver using the databaseClasspath attribute.

You must also add the following lines to an appropriate place in your Ant build file so Ant can locate the necessary Sqlch classes:

<taskdef name="dbexecute" classname="uk.co.novem.oss.sqlch.ant.DbExecuteTask"/>
<typedef name="truncate" classname="uk.co.novem.oss.sqlch.ant.types.TruncateOperationFactory"/>
<typedef name="loaddata" classname="uk.co.novem.oss.sqlch.ant.types.LoadDataOperationFactory"/>
<typedef name="savedata" classname="uk.co.novem.oss.sqlch.ant.types.SaveDataOperationFactory"/>
<typedef name="deletedata" classname="uk.co.novem.oss.sqlch.ant.types.DeleteDataOperationFactory"/>
<typedef name="alteroracleconstraints" classname="uk.co.novem.oss.sqlch.ant.types.AlterOracleConstraintsOperationFactory"/>



SourceForge.net Logo

Sqlch SourceForge Distribution: 0.1Alpha8 20041026 2208