Recently I had to adjust some of our JMS configuration and needed make sure we set the ServerPeerID configuration value to a unique value among our servers.  We have a unique server number in our database so I figured that I would just use that value.  In order to do this, I needed to get the database value into an Ant property, which is then used to generate the configuration file, which includes the ServerPeerID.  Below is the Ant task and steps I used to do this.
Steps:
- Define where the SQL results will be written
 
- Make sure the file does not already exist
 
- SQL task to get the result
 
- Load the file back into a property
 
Use the propertyregex task to strip out just the unique number  
Warning: The syntax highlighter appears to be reformatting my XML and not allowing the self closing tags.  Probably my problem but you should be able to get the idea from the 
   
   
   
      
      SELECT PREF_VALUE FROM PREFERENCE WHERE PREFERENCE_ID = 71;