Matt Fellows
Matt Fellows

Reputation: 6522

How to dynamically add datasources to jboss 7

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?

Upvotes: 1

Views: 4816

Answers (1)

Kazaag
Kazaag

Reputation: 2145

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.

Upvotes: 3

Related Questions