Discussion:
[jboss-user] [IronJacamar] - Test connection through CLI when <allow-multiple-users/> is applied to a datasource
anuragdebnath
2013-02-27 13:11:21 UTC
Permalink
anuragdebnath [https://community.jboss.org/people/anuragdebnath] created the discussion

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

To view the discussion, visit: https://community.jboss.org/message/799863#799863

--------------------------------------------------------------
*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 -
**************************************
[***@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 https://issues.jboss.org/browse/JBJCA-990
--------------------------------------------------------------

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

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
Jesper Pedersen
2013-02-27 15:09:22 UTC
Permalink
Jesper Pedersen [https://community.jboss.org/people/jesper.pedersen] created the discussion

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

To view the discussion, visit: https://community.jboss.org/message/799896#799896

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

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

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
anuragdebnath
2013-02-27 15:32:18 UTC
Permalink
anuragdebnath [https://community.jboss.org/people/anuragdebnath] created the discussion

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

To view the discussion, visit: https://community.jboss.org/message/799906#799906

--------------------------------------------------------------
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#799896 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>
--------------------------------------------------------------

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

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
Jesper Pedersen
2013-02-27 15:34:09 UTC
Permalink
Jesper Pedersen [https://community.jboss.org/people/jesper.pedersen] created the discussion

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

To view the discussion, visit: https://community.jboss.org/message/799907#799907

--------------------------------------------------------------
You need a <security> element
--------------------------------------------------------------

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

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
anuragdebnath
2013-02-28 09:00:34 UTC
Permalink
anuragdebnath [https://community.jboss.org/people/anuragdebnath] created the discussion

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

To view the discussion, visit: https://community.jboss.org/message/800024#800024

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

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

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
Jesper Pedersen
2013-02-28 16:49:13 UTC
Permalink
Jesper Pedersen [https://community.jboss.org/people/jesper.pedersen] created the discussion

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

To view the discussion, visit: https://community.jboss.org/message/800117#800117

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

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

Start a new discussion in IronJacamar at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2098]
Loading...