Search code examples
oracle-databasejbossjndipassword-encryptionlogin-config.xml

Mutli oralce Datasource Password Encryption in Jboss


I need to configure encrypted password for Jboss. Right now i have direct username password in oracle-ds.xml.

https://docs.jboss.org/jbosssecurity/docs/6.0/security_guide/html/Encrypting_Data_Source_Passwords.html

After going through above Url, I removed username and password from oracle-ds.xml and added a new policy in login-config.xml and mapped the policy in oralce-ds.xml.

Its working fine, in case of single JNDI-name. (Single datasource)

In another application i have 5 data sources in Oracle-ds.xml.

1) I tried adding different policies in login-config and mapped respective in oracle-ds.xml - But it is not working

2) And I tried adding login-module under single policy, - But failed

Can someone help me on this?


Solution

  • If you simply need to map your Oracle connection to N different JNDI names due to the names stored in your applications' persistence.xml, you can use the concept of aliasing.

    <mbean code="org.jboss.naming.NamingAlias" 
       name="jboss.jca:name=jdbc/myFirstDS,service=DataSourceBinding">
    <attribute name="ToName">java:jdbc/mySecondDS</attribute>
    <attribute name="FromName">java:jdbc/myFirstDS</attribute>
    </mbean>