2 Replies Latest reply on Mar 17, 2011 11:33 AM by jesse.hazen

    Multiple DS's - single application-policy?

    jesse.hazen

      Hello,

       

      I looked through every doc I could find, and did a fair amount of googling as well, and couldnt find the answer. Unfortunately, I cannot test the configuration as I do not have a test environment that is available to me for this particular application. Any pointers would be greatly appreciated!

       

      I am using JBoss 5.1.0. I administer an application which requires multiple data sources (and more to be added in the future) which use the same login credentials. I an going to encrypt these login credentials, but is there any way to only add a single <application-policy> which could encompass all data sources?

       

      For example, the *-ds.xml file may look like:

       

       

         <local-tx-datasource>

               <jndi-name>ds1</jndi-name>

               <connection-url>jdbc:sqlserver://server:1433;databaseName=db1</connection-url>

               <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>

               <security-domain>EncryptedDS</security-domain>

               <min-pool-size>1</min-pool-size>

               <max-pool-size>5</max-pool-size>

               <idle-timeout-minutes>0</idle-timeout-minutes>

               <check-valid-connection-sql>select 1</check-valid-connection-sql>

               <metadata>

                  <type-mapping>MS SQLSERVER</type-mapping>

               </metadata>

         </local-tx-datasource>

         <local-tx-datasource>

               <jndi-name>ds2</jndi-name>

               <connection-url>jdbc:sqlserver://server:1433;databaseName=db2</connection-url>

               <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>

               <security-domain>EncryptedDS</security-domain>

               <min-pool-size>1</min-pool-size>

               <max-pool-size>5</max-pool-size>

               <idle-timeout-minutes>0</idle-timeout-minutes>

               <check-valid-connection-sql>select 1</check-valid-connection-sql>

               <metadata>

                  <type-mapping>MS SQLSERVER</type-mapping>

               </metadata>

         </local-tx-datasource>

       

       

       

       

      And my login-config.xml may look like

       

      ...

        <!-- Encrypted DS password for application -->

        <application-policy name="EncryptedDS">

          <authentication>

            <login-module code="org.jboss.resource.security.SecureIdentityLoginModule" flag="required">

              <module-option name="username">admin</module-option>

              <module-option name="password">encryptedpass</module-option>

              <module-option name="managedConnectionFactoryName">jboss.jca:name=ds1,service=LocalTxCM</module-option>

            </login-module>

          </authentication>

        </application-policy>

       

       

      But I'm not sure how to make the login-config.xml use that application-policy for both data sources. Would I need to add another <module-option name="managedConnectionFactoryName"> line, or can I semi-colon delimit the data source JNDI names? Or, is there anorther way to do this?

       

      If I have to add an application-policy for each and every data source, that works; but it would be nice if I could just point all data sources to a single application-policy.

       

       

       

      Thanks in advance for any pointers/help!