Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Ant build should fail on java.sql.Exception

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am using the following ant script for creating my databases:



Because i am using onerror="abort" It is aborting the ant build if any file produces the sql exception and stop executing that specific sql file.
For example if data3.sql having some err it will abort the ant but data1.sql and data2.sql files have already executed and their results do not roll back.
Is it possible to abort the whole operation rather that aborting the execution of a single sql file.?
What i want is that if any one of the sql files produces sql exception, all files which have already been executed before that file also roll back their output.

If anybody has any idea please help me.

Thanks and Regards,

 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You currently have set up the task to run three separate transactions. Try placing all of the sql files into a single transaction like this:


 
Khushwinder Chahal
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Peter for your reply.

when i am trying to execute like the following :



Its giving me err that

build failed
build.xml:5: only single argument resource collections are supported.


One more thing is that in my rela project my script files are not in a single folder they are in separate folders.
Please suggest me any way out of this problem.

Thanks and Regards,
 
Khushwinder Chahal
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now i am trying to do it like the following :



It is stop executing a specific file's script if it contains any err because autocommit="false" but it does not roll back the results of other script files which have been executed already.
If any body has any idea?
thanks and regards,
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error "only single argument resource collections are supported. " tells me that the sql task will not let you span a transaction across multiple SQL source files. So try this: use the concat task to create a temporary file containing all of the SQL sources, give that temp file to the sql task, delete the temp file afterwards.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic