[jboss-user] [Datasource Configuration] - Multiple DS's - single application-policy?

Jesse Hazen do-not-reply at jboss.com
Wed Mar 16 13:39:19 EDT 2011


Jesse Hazen [http://community.jboss.org/people/jesse.hazen] created the discussion

"Multiple DS's - single application-policy?"

To view the discussion, visit: http://community.jboss.org/message/593564#593564

--------------------------------------------------------------
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!
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/593564#593564]

Start a new discussion in Datasource Configuration at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110316/f69887c0/attachment.html 


More information about the jboss-user mailing list