This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
"I'm not back." - Bill Harding, Twister
Joined: Jan 30, 2000
All right, I was able to get hold of traditional JDBC connection info I can use instead: URL, username, password. Seems odd though that using a datasource isn't supported here. Oh well.