How to dynamically add datasources to jboss 7

心已入冬 提交于 2019-12-11 09:49:52

问题


I have an application which dynamically adds databases for each instance of the application, and which then, on JBoss 5 would write a datasource file out into the deploy folder, so that the application could make use of the new database (And be locked down to it).

In JBoss 7 the datasource configuration is inside standalone.xml. And more importantly if I enter new datasources into this file, they don't seem to get read and no datasource is available.

Does anyone have any idea how I can reproduce this behaviour once we upgrade to JBoss 7?


回答1:


In newer version of JBoss AS7 -ds.xml strategy will work.

But management CLI offer you another way to perform it (as they will be no scanning delay it is probably a more recommended way).

You can either call jboss-cli.sh with command file (detail on how to do it can be found here: http://planet.jboss.org/post/how_to_create_an_manage_datasources_in_as7) or you can use the directly the native API (https://docs.jboss.org/author/display/AS71/The+native+management+API).

With the later method in addition to add, you will be able to query the existing data sources and update them.



来源:https://stackoverflow.com/questions/11339736/how-to-dynamically-add-datasources-to-jboss-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!