ant - sql task with filesets?

Posted on 2009-04-21
Medium Priority
Last Modified: 2013-11-10
in our automated build environment, i want to include DB migrate scripts in an ant target.

the scripts are put into a subdir "migrate" for each new scheduled release, and are named X_y.sql (X being the major, Y the minor version number of the release).

how can i dynamically include all migrate-scripts and execute them with the <sql> task in chronological order (0_9.sql before 1_0.sql before 1_1.sql etc.)?
Question by:thomers1
LVL 12

Expert Comment

by:Gibu George
ID: 24195124
The ant sql task cannot be used for this, to do this you need to write a custom ant task whihc does this, other wise you nee to specify the files in the order of executuion in side tha ant sql task

Accepted Solution

rsneale earned 2000 total points
ID: 24334027
I just happened by and thought I might contribute.    Assuming that a file and the ant sql task can preform the desired operation, then you can automate this via the ant contrib foreach task

Basically you create a file set,,sort it and supply it to foreach.
The foreach will iterate over each file and preform the sql action.

I have done this several times.

If there is still interest, holler.

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question