简体   繁体   中英

Multiple Datasources with same JNDI in WebSphere Liberty

Is it possible to have multiple datasources with the same JNDI name in Liberty. 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. [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. [WARNING ] CWWKG0076W: The previous configuration for dataSource with id REPORTSDB_JNDI is still in use.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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