• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 842
  • Last Modified:

ant - sql task with filesets?

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.)?
1 Solution
Gibu GeorgeChief Technology OfficerCommented:
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
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now