File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "SQL" Watch "SQL" New topic
Author

SQL

James Daniel
Ranch Hand

Joined: Sep 24, 2004
Posts: 79
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.

Jim
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30136
    
150

Jim,
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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Frank Carver
Sheriff

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: 79
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: 79
I am still getting the error. Plain SQL scripts work but PLSQL fail.

Script I am trying to run:

begin
select count(*) from abc;
end;

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
 
Similar Threads
Ant exec task -- unable to execute a command
Which Oracle certification to give?
open source business engine
How does DbVisualizer hadle heavy load?
how to execute .sql file using java