[wildfly-dev] using <xa-datasource> and <data-source> with same driver and other related questions

Brian Stansberry brian.stansberry at redhat.com
Sat May 6 11:31:06 EDT 2017


The xa-datasource-class attribute on a jdbc-driver=* management resource has no impact on any runtime service. The driver-xa-datasource-class-name attribute does.

The handler for the jdbc-driver=*:add operation will store any value for xa-datasource-class in the resource’s in-memory management model, but it does not pass it into any runtime service, so it’s essentially cruft. The persister for the subsystem also does not persist the value, so if the server is reloaded/restarted after you add it, the value is lost.

Note that the xa-data-source=* resource also has an attribute called xa-datasource-class. That’s a different thing.

> On May 5, 2017, at 5:54 PM, John Mazzitelli <mazz at redhat.com> wrote:
> 
> Note - the reason I am asking is the ManageIQ folks are going to create some UI pages to push JDBC drivers to managed WildFly servers and there is confusion as to how to specify the XA datasource class name.
> 
> Do they set "driver-xa-datasource-class-name" ?
> 
> Do they set "xa-datasource-class" ??
> 
> Do they set both?
> 
> This is for both EAP 6.4 and EAP 7.x (but I believe the model didn't change between 6.4 and 7.x).
> 
> ----- Original Message -----
>> Ramesh,
>> 
>> When you say "this attribute also defines which one to use..." what is "this
>> attribute" referring to?
>> 
>> Are you referring to the "driver-xa-datasource-class-name" attribute or
>> "xa-datasource-class" attribute (which is the one that Brian thinks is
>> really not used)??
>> 
>> Note that I"m not referring to the XML elements (of which there is the one
>> "xa-datasource-class") - I'm referring to the DMR model attributes.
>> 
>> BTW: the XML element name vs. the DMR attribute name results in utter
>> confusion :) Why is the XML element called "xa-datasource-class" - but that
>> doesn't set the value of DMR attribute "xa-datasource-class" (which is the
>> same name)? Instead it affects the DMR attribute
>> "driver-xa-datasource-class-name".
>> 
>> 
>> --John Mazz
>> 
>> ----- Original Message -----
>>> 2)if there more than one Driver or Data Source class in the defined module,
>>> this attribute also defines which one to use to create the connection
>>> 
>>> ----- Original Message -----
>>>> Quick and dirty answers..
>>>> 
>>>> 1) Yes.
>>>> 
>>>> 2) I believe the xa-datasource-class management attribute on the driver
>>>> resources is cruft. The code related to drivers does not use it beyond
>>>> storing a value in the model.
>>>> 
>>>> 3) I *think* that relates to the method java.sql.Driver.jdbcCompliant(),
>>>> whose javadoc says:
>>>> 
>>>> "Reports whether this driver is a genuine JDBC Compliant™ driver. A
>>>> driver
>>>> may only report true here if it passes the JDBC compliance tests;
>>>> otherwise
>>>> it is required to return false.
>>>> JDBC compliance requires full support for the JDBC API and full support
>>>> for
>>>> SQL 92 Entry Level. It is expected that JDBC compliant drivers will be
>>>> available for all the major commercial databases.
>>>> 
>>>> This method is not intended to encourage the development of non-JDBC
>>>> compliant drivers, but is a recognition of the fact that some vendors are
>>>> interested in using the JDBC API and framework for lightweight databases
>>>> that do not support full database functionality, or for special databases
>>>> such as document information retrieval where a SQL implementation may not
>>>> be
>>>> feasible."
>>>> 
>>>>> On May 5, 2017, at 12:52 PM, John Mazzitelli <mazz at redhat.com> wrote:
>>>>> 
>>>>> I have a stupid question and two not-so-stupid questions.
>>>>> 
>>>>> 1. I think I know the answer but I really just need confirmation.
>>>>> 
>>>>> Suppose I have this defined in standalone.xml:
>>>>> 
>>>>> <driver name="h2" module="com.h2database.h2">
>>>>>    <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
>>>>> <driver>
>>>>> 
>>>>> Notice it defines the XA datasource class.
>>>>> 
>>>>> I can share this with both a non-XA <data-source> and a XA
>>>>> <xa-data-source>, correct? So this is OK:
>>>>> 
>>>>> <datasource jndi-name="java:/foo">
>>>>> <driver>h2</driver>
>>>>> <datasource>
>>>>> 
>>>>> <xa-datasource jndi-name="java:/bar">
>>>>> <driver>h2</driver>
>>>>> <xa-datasource>
>>>>> 
>>>>> That's the stupid question.
>>>>> 
>>>>> 2. Here a second question - what is the purpose of both
>>>>> "driver-xa-datasource-class-name" and "xa-datasource-class". The weird
>>>>> thing is the XML in standalone.xml uses "xa-datasource-class" but that
>>>>> seems to be the value of the attribute
>>>>> "driver-xa-datasource-class-name"
>>>>> -
>>>>> what is this xa-datasource-class ATTRIBUTE?
>>>>> 
>>>>> The docs are not clear here:
>>>>> https://wildscribe.github.io/Wildfly/10.0.0.Final/subsystem/datasources/jdbc-driver/index.html
>>>>> 
>>>>> where it says:
>>>>> 
>>>>>  * driver-xa-datasource-class-name The fully qualified class name of
>>>>>  the
>>>>>  javax.sql.XADataSource implementation module-slot The slot of the
>>>>>  module
>>>>>  from which the driver was loaded, if it was loaded from the module
>>>>>  path
>>>>>  profile Domain Profile in which driver is defined. Null in case of
>>>>>  standalone server
>>>>>  * xa-datasource-class XA datasource class
>>>>> 
>>>>> 3. Third question - what is this "jdbc-compliant" attribute used for?
>>>>> The
>>>>> docs don't indicate what it would actually be used for:
>>>>> 
>>>>>  * jdbc-compliant - Whether or not the driver is JDBC compliant
>>>>> 
>>>>> If I am defining a JDBC driver, wouldn't you think it is JDBC
>>>>> compliant?
>>>>> :-)
>>>>> 
>>>>> Thanks.
>>>>> _______________________________________________
>>>>> wildfly-dev mailing list
>>>>> wildfly-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>>>> 
>>>> --
>>>> Brian Stansberry
>>>> Manager, Senior Principal Software Engineer
>>>> JBoss by Red Hat
>>>> 
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> wildfly-dev mailing list
>>>> wildfly-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>>> 
>> 
> 
> _______________________________________________
> wildfly-dev mailing list
> wildfly-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/wildfly-dev

-- 
Brian Stansberry
Manager, Senior Principal Software Engineer
JBoss by Red Hat






More information about the wildfly-dev mailing list