简体   繁体   English

WebSphere Liberty 中具有相同 JNDI 的多个数据源

[英]Multiple Datasources with same JNDI in WebSphere Liberty

Is it possible to have multiple datasources with the same JNDI name in Liberty.在 Liberty 中是否可以有多个具有相同 JNDI 名称的数据源。 I tried to do the same but got these errors:我试图做同样的事情,但得到了这些错误:

[ERROR ] CWWKG0031E: The value jdbc/konyreports specified for unique attribute jndiName.unique is already in use. [错误] CWWKG0031E: 为唯一属性 jndiName.unique 指定的值 jdbc/konyreports 已在使用中。 [ERROR ] CWWKG0074E: Unable to update the configuration for dataSource with the unique identifier REPORTSDB_JNDI because of the exception: The value jdbc/konyreports for attribute jndiName.unique is not unique. [错误] CWWKG0074E: 无法使用唯一标识符 REPORTSDB_JNDI 更新数据源的配置,因为以下异常:属性 jndiName.unique 的值 jdbc/konyreports 不是唯一的。 [WARNING ] CWWKG0076W: The previous configuration for dataSource with id REPORTSDB_JNDI is still in use. [警告] CWWKG0076W: 标识为 REPORTSDB_JNDI 的数据源的先前配置仍在使用中。

This was my config:这是我的配置:

 <dataSource id="ACCOUNTSDB_JNDI" jndiName="jdbc/konyaccounts"> <jdbcDriver libraryRef="DabaseConnector" /> <properties.microsoft.sqlserver databaseName="liberty1" serverName="mydb.konylabs.net" portNumber="1433" user="myUser" password="myPass" /> </dataSource> <dataSource id="KONY_ACCOUNTS_LOGGER_JNDI" jndiName="jdbc/konyaccounts"> <jdbcDriver libraryRef="DabaseConnector" /> <properties.microsoft.sqlserver databaseName="liberty1" serverName="mydb.konylabs.net" portNumber="1433" user="myUser" password="myPass" /> </dataSource>

No, it is not possible to have multiple datasources with the same JNDI name.不,不可能有多个具有相同 JNDI 名称的数据源。

What would you be trying to achieve by having multiple datasources with identical credentials anyway?无论如何,通过拥有多个具有相同凭据的数据源,您将尝试实现什么? You can simply eliminate the duplicate configuration and you should have the same behavior by only using one set of datasource config.您可以简单地消除重复配置,并且仅使用一组数据源配置就应该具有相同的行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM