java 如何在 JBoss 中检查数据源?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5212284/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to check datasource in JBoss?
提问by IAdapter
I have a datasource, how to check if its ok? maybe somehow using jmx-console?
我有一个数据源,如何检查它是否正常?也许以某种方式使用 jmx 控制台?
回答by Lukasz Stelmach
If you want just check if data source is installed and some statistic information about it you can read that bean: jboss.jca:name=DefaultDS,service=ManagedConnectionPool
.
如果你只想检查是否安装了数据源和关于它的一些统计信息,您可以读取豆:jboss.jca:name=DefaultDS,service=ManagedConnectionPool
。
You can find such bean for each data source, just change DefaultDS
with the data source name.
您可以为每个数据源找到这样的 bean,只需更改DefaultDS
数据源名称即可。
回答by Jan
With JBoss 7, you can use the jboss-admin command line tool to test the datasource. Run this line in jboss-admin (after adjusting the JNDI name of the datasource, and example assuming that it is an XA datasource):
使用 JBoss 7,您可以使用 jboss-admin 命令行工具来测试数据源。在 jboss-admin 中运行这一行(在调整数据源的 JNDI 名称后,假设它是 XA 数据源的示例):
/subsystem=datasources/xa-data-source=java\:jboss/datasources/XAOracleDS:test-connection-in-pool
/subsystem=datasources/xa-data-source=java\:jboss/datasources/XAOracleDS:test-connection-in-pool
More details can be found here: http://www.javalinux.it/wordpress/2011/07/14/how-to-create-an-manage-datasources-in-as7/
更多细节可以在这里找到:http: //www.javalinux.it/wordpress/2011/07/14/how-to-create-an-manage-datasources-in-as7/
回答by Denis Bredelet
The above did not work for me, but this worked-
以上对我不起作用,但这有效-
Run this line in jboss-cli:
在 jboss-cli 中运行这一行:
/subsystem=datasources/xa-data-source=jdbc\/XAOracleDS:test-connection-in-pool
/subsystem=datasources/xa-data-source=jdbc\/XAOracleDS:test-connection-in-pool
回答by Mohnish
Using Jboss CLI, a datasource (e.g. MyDS) can be targeted directly:
使用 Jboss CLI,可以直接定位数据源(例如 MyDS):
/subsystem=datasources/data-source=MyDS:test-connection-in-pool
/subsystem=datasources/data-source=MyDS:test-connection-in-pool