How can I configure JBoss JDBC data source connections outside the XML config file?
-
06-07-2019 - |
Question
I would like to override the portion of JBoss that loads JDBC connection information from the XML config file. I would like to continue using the rest of JBoss's connection pooling/caching features. I just want to load the connection data from another source.
Which MBean should I be implementing and how do I configure the override in JBoss?
Solution
The JBoss -ds.xml descriptors actually cover a multitude of sins. If you look on the JBoss JVM console, you'll find 4 or 5 MBeans there for each data source. You could potentially do this programmatically, but I wouldn't give good odds on your chances.
My suggestion would be to use a 3rd-party connection pooling library (e.g. Commons DBCP). Define the pool using that, and then bind the resulting DataSource to JNDI. CLient application using the pool shouldn't know any difference.