Tomcat doesn't have "a" datasource, but it can support as many datasources as you want.
Most of the time I configure my datasources on a per-application basis, so I just put all that info in the context.xml file for the webapp along with all the other app config information. JBoss, however, goes for server-wide configurations. The view from the application is the same, however.
Using JMX to configure Tomcat is usually overkill, since you can't usually modify a database connection pool on the fly - you do it before the app goes online and (usually) leave it alone as long as the app is running, since otherwise you're in much the same situation as someone attempting to change tires on a moving automobile.
There are a number of ways to do what you're asking, but I'm actually not sure if they're worth the trouble.
An IDE is no substitute for an Intelligent Developer.
Joined: Mar 11, 2011
thanks for the answer...
i think i will solve this issue with java IO and jdom. so just insert the datasource in the xml file.
i thought using jmx would be a nicer way because i could develop against the api.