【问题标题】:Wildfly get datasource parametersWildfly 获取数据源参数
【发布时间】:2016-05-06 18:58:51
【问题描述】:

是否可以获得数据源参数的值,因为它们是在standalone.xml 中配置的?也就是说,我需要密码和用户名。

【问题讨论】:

  • 为什么需要用户名和密码?
  • 使用其他需要访问相同架构的 Oracle 服务。

标签: jdbc datasource wildfly


【解决方案1】:

使用 jboss-cli 可以做到这一点。给定示例数据源,您可以这样读取属性:

/subsystem=datasources/data-source=ExampleDS:read-attribute(name=user-name)

完整示例:

jboss-cli.bat

You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] embed-server
[standalone@embedded /] /subsystem=datasources/data-source=ExampleDS:read-attribute(name=user-name)
{
    "outcome" => "success",
    "result" => "sa"
}
[standalone@embedded /] /subsystem=datasources/data-source=ExampleDS:read-attribute(name=password)
{
    "outcome" => "success",
    "result" => "sa"
}

https://docs.jboss.org/author/display/WFLY8/CLI+Recipes有一些例子

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-03-15
    • 1970-01-01
    • 1970-01-01
    • 2014-03-17
    • 2015-03-21
    • 2015-04-21
    • 2014-04-02
    • 1970-01-01
    相关资源
    最近更新 更多