5 Replies Latest reply on Feb 28, 2013 11:49 AM by jesper.pedersen

    Test connection through CLI when <allow-multiple-users/> is applied to a datasource

    anuragdebnath

      Environment :

       

      JBoss EAP-6.0.1

      JBoss AS 7.1.3

      IronJacamar version used in above JBoss version - 1.0.13.Final

       

      Issue :

       

      Create a XA data-source(via CLI) which has the attribute <allow-multiple-users/> defined to true.

      Testing the connection using CLI shows the below error -
      **************************************
      [standalone@localhost:9999 /] /subsystem=datasources/xa-data-source=OracleXA_DS:test-connection-in-pool()

      { "outcome" => "failed", "failure-description" => "JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid", "rolled-back" => true }

      **************************************

      On checking the description of the attribute ( /subsystem=datasources/xa-data-source=OracleXA_DS:read-resource-description(recursive=true) )  it says -

      "allow-multiple-users" => {
      "type" => BOOLEAN,
      "description" => "Specifies if multiple users will access the datasource through the getConnection(user, password) method and hence if the internal pool type should account for that"

       

      When testing the connection through "test-connection-in-pool" there is no way to provide username/password for the above mentioned getConnection() and hence connection fails.

      To confirm if applying <allow-multiple-users/> is a valid attribute to a datasource, i tested the same using a simple JDBC code and supplied the credentials to the .getConnection() like below and it works well-

      InitialContext ic = new InitialContext();

      Datasource ds = (DataSource)ic.lookup("java:/etsDataSourcexa");

      Connection con = ds.getConnection("jboss","jboss");

       

       

      I have raised a JIRA [1] but would like to know the expert's thought

       

      [1] https://issues.jboss.org/browse/JBJCA-990

        • 1. Re: Test connection through CLI when <allow-multiple-users/> is applied to a datasource
          jesper.pedersen

          First of all - don't create JIRAs before we have come to a conclusion on the possible feature.

           

          Second - you havn't posted your configuration of the datasource. The test-connection-in-pool will use the default credentials specified, so why isn't that working ?

           

          However, I do see a possible use-case for an overloaded test-connection-in-pool method, but the core signature of method is different than you describe. Datasources are just one usage of JCA.

          • 2. Re: Test connection through CLI when <allow-multiple-users/> is applied to a datasource
            anuragdebnath

            >> First of all - don't create JIRAs before we have come to a conclusion on the possible feature. - See more at: https://community.jboss.org/message/799896#799896

             

            I will make a Note of it from next time onwards. Thanks.

             

            >> Second - you havn't posted your configuration of the datasource. The test-connection-in-pool will use the default credentials specified, so why isn't that working ?

             

            Here is the datasource snippet with <allow-multiple-users/> applied -

             

            <xa-datasource jndi-name="java:/etsDataSourcexa" pool-name="OracleXA_DS" enabled="true">

                                <xa-datasource-property name="URL">

                                    XXXX

                                </xa-datasource-property>

                                <driver>ojdbc6.jar</driver>

                                <new-connection-sql>select 1 from dual</new-connection-sql>

                                <xa-pool>

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

                                    <max-pool-size>100</max-pool-size>

                                    <allow-multiple-users/>

                                </xa-pool>

                                <validation>

                                    <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>

                                    <background-validation-millis>30000000</background-validation-millis>

                                    <stale-connection-checker class-name="org.jboss.resource.adapter.jdbc.vendor.OracleStaleConnectionChecker"/>

                                    <exception-sorter class-name="org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter"/>

                                </validation>

                                <statement>

                                    <prepared-statement-cache-size>25</prepared-statement-cache-size>

                                </statement>

                            </xa-datasource>

             

            <driver name="ojdbc6.jar" module="com.oracle">

                                    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>

                                </driver>

            • 3. Re: Test connection through CLI when <allow-multiple-users/> is applied to a datasource
              jesper.pedersen

              You need a <security> element

              • 4. Re: Test connection through CLI when <allow-multiple-users/> is applied to a datasource
                anuragdebnath

                Hi Jesper,

                 

                I did try with the <security> element but that does not helps.

                 

                The <user-name> and <password> that we provide in the <security> element is the default DB credentials to acess the database.

                The point  is, if I have "<allow-multiple-users/>" the same credentials cannot be used by/for different users.

                 

                Here is the new updated datasource config -

                 

                <xa-datasource jndi-name="java:/etsDataSourcexa" pool-name="OracleXA_DS" enabled="true">

                                    <xa-datasource-property name="URL">

                                        XXXX

                                    </xa-datasource-property>

                                    <driver>ojdbc6.jar</driver>

                                    <new-connection-sql>select 1 from dual</new-connection-sql>

                                    <xa-pool>

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

                                        <max-pool-size>100</max-pool-size>

                                        <allow-multiple-users/>

                                    </xa-pool>

                                    <security>

                                        <user-name>jboss</user-name>

                                        <password>jboss</password>

                                    </security>

                                    <validation>

                                        <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>

                                        <background-validation-millis>30000000</background-validation-millis>

                                        <stale-connection-checker class-name="org.jboss.resource.adapter.jdbc.vendor.OracleStaleConnectionChecker"/>

                                        <exception-sorter class-name="org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter"/>

                                    </validation>

                                    <statement>

                                        <prepared-statement-cache-size>25</prepared-statement-cache-size>

                                    </statement>

                                </xa-datasource>

                <driver name="ojdbc6.jar" module="com.oracle">

                                        <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>

                                    </driver>

                • 5. Re: Test connection through CLI when <allow-multiple-users/> is applied to a datasource
                  jesper.pedersen

                  I have changed the JIRA to correctly reflect the feature asked for