I've got an
ant build file with a "db" target that creates a fresh new database. This currently uses a sql task to drop and create tables. The connection is made by specifying the driver, url, userid, and password. Works fine. However now I need to modify this to use a datasource instead. I have the JNDI name of the datasource, but the sql task doesn't seem to support connecting via JNDI. Am I missing something here? Is there some other way in an ant script to connect to a datasource and execute some arbitrary SQL statements?
I could write a
Java class that opens the connection I suppose. But it seems like I wouldn't be the first person to want to do something like this, so I suspect there's another way. Anyone?
Ah, with a bit more research I see that
here Roseanne mentions having the same problem a few years ago and writing a custom task. Roseanne, is that code available anywhere? Or has any other solution arisen since then?