--- Matt Small <[EMAIL PROTECTED]> wrote: > Does anybody have any suggestions on what I can do here. I think I can > do this with the script tag but I'd like to stay away from that. > Could I do this with a custom task maybe?
You can do just about anything with a custom task :) But if you'd rather stay away from that as well, then it depends on how indeterminate the number of DBs you want to do it for really is. > What I want to do is have ant generically read a dbNames property, and > for each name in that load a set of configuration params. For each name > it would copy a properties file into the final app and do the proper > replacement. > Thus for each database I would have one database.properties file. > > In the properties file read by ant: > > dbNames=db1,db2 > > db1.dbUser=user1 > db1.dbPassword=user1pwd > db1.dbServer=server1 > db1.dbName=database1 > > db2.dbUser=user2 > db2.dbPassword=user2pwd > db2.dbServer=server2 > db2.dbName=database2 In other words, rather than having this one file to hold all these values, why not put each in its own properties file? If you do that, and if you always want to include them all, then things get a bit more doable. But if you don't, then you'll most probably need to go with a script or custom task (or at least a couple of the available but non-standard ones, such as <foreach> and <xproperty>). > Then I have a database.properties file like this: > > dbUser=@dbUser@ > dbPassword=@dbPassword@ > dbAlias=@dbServer@ > dbURL=jdbc:informix-sqli://@dbServer@:4004/@dbName@:INFORMIXSERVER=@dbServer > @;user=@dbUser@;password=@dbPassword@ > > That would be replaces such that there would be two properties files in > my webapp, database_db1.properties and database_db2.properties. My app > would then know to setup two (or more) database connections. > > Any suggestions are greatly appreciated. Depends on whether you'd always want all the DBs that you have properties files for to go, or whether you want to be able to specify only certain ones. Diane ===== ([EMAIL PROTECTED]) __________________________________________________ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
