Incanto is good open source tool to invoke SQL*Plus from within Ant scripts.
Use Incanto
* Download Incanto from its download link. I downloaded incanto-0.2.4.zip.
* Unzip into an empty directory.
* Include incanto jar file in classpath
set CLASSPATH=c:\incanto-0.2.4\incanto-0.2.4.jar;%CLASSPATH%
* Use in ant scripts. See http://incanto.sourceforge.net/usage.html for details.
– Add xmlns:ora=”antlib:net.sf.incanto” as project attribute.
– Use ora:sqlplus Ant task.
<project name="Test.Incanto" basedir="." default="test.db" xmlns:ora="antlib:net.sf.incanto"> <target name="test.db"> <ora:sqlplus logon="scott/tiger@orcl" start="./test.sql"/> </target> </project>