jQuery in Action, 3rd edition
The moose likes Ant, Maven and Other Build Tools and the fly likes SQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "SQL" Watch "SQL" New topic


James Daniel
Ranch Hand

Joined: Sep 24, 2004
Posts: 80
I am trying to run Oracle SQL scripts via Ant. Everything works fine if they are plain SQL commands. If, the script includes both PLSQL and SQL commands, the script fails. The script runs fine in Toad. I assume Toad has a parser that differentiates between SQL and PLSQL. Has anyone heard of a way to mimic what Toad does in Ant? Any help would be greatly appreciated.

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33132

If you don't find a PLSQL task, you can always call TOAD through an OS script. Which Ant can call using the exec task.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
Presumably your complex scripts consist of multiple statements on multiple lines. The Ant SQL Task has a bunch of optional configurations to do with processing of separators and (re)formatting of scripts - can you give us any more details on which options you have tried?
[ January 10, 2007: Message edited by: Frank Carver ]

Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
James Daniel
Ranch Hand

Joined: Sep 24, 2004
Posts: 80
I have tried a plain vanilla Ant call of SQL script. I do see that a "keepformat" switch. I will try that.
James Daniel
Ranch Hand

Joined: Sep 24, 2004
Posts: 80
I am still getting the error. Plain SQL scripts work but PLSQL fail.

Script I am trying to run:

select count(*) from abc;

Exception thrown:

java.sql.SQLException: ORA-06550: line 3, column 33:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ;

at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:398)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
I agree. Here's the link: http://aspose.com/file-tools
subject: SQL
jQuery in Action, 3rd edition