jboss 7 如何动态添加数据源 [英] How to dynamically add datasources to jboss 7

查看:28
本文介绍了jboss 7 如何动态添加数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,它为应用程序的每个实例动态添加数据库,然后在 JBoss 5 上将数据源文件写入部署文件夹,以便应用程序可以使用新数据库(并且是锁定它).

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).

在 JBoss 7 中,数据源配置在 standalone.xml 中.更重要的是,如果我在这个文件中输入新的数据源,它们似乎不会被读取,也没有可用的数据源.

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.

有人知道我们升级到 JBoss 7 后如何重现这种行为吗?

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

推荐答案

在较新版本的 JBoss AS7 中 -ds.xml 策略将起作用.

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

但是管理 CLI 为您提供了另一种执行方式(因为它们不会有扫描延迟,因此可能是更推荐的方式).

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

您可以使用命令文件调用 jboss-cli.sh(有关如何操作的详细信息,请参见此处:http://planet.jboss.org/post/how_to_create_an_manage_datasources_in_as7) 或者你可以直接使用原生 API (https://docs.jboss.org/author/display/AS71/The+native+管理+API).

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).

后面的方法除了 add 之外,还可以查询现有的数据源并进行更新.

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

这篇关于jboss 7 如何动态添加数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆