ant - sql task with filesets?

Posted on 2009-04-21
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
    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
    LVL 2

    Accepted Solution

    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

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    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…
    Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
    The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now