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

Ramesh Reddy rareddy at redhat.com
Sat May 6 10:06:42 EDT 2017


Sorry, I was mentioning the xml element in the standalone.xml file. Since it looks like you are trying to configure programtically or using the CLI then we need to find the DMR property that corresponds to this xml-element, and that could be one you are mentioning. You really do not need to use property at all, unless the situation is

1) You deployed the JDBC driver jar file, using CLI or programtically. If the driver jar has jdbc4 service loader mechanism, it loads the jar file JDBC "driver" automatically.
2) If this deployed jar file has multiple Driver classes, in its service loader file, then the WildFly has ambuguity to choose the driver. So, this property will define the JDBC driver name to use.

The above is for when using the Jdbc's Driver class, if you are trying to create the DataSource or XADataSource class, then when you deploy a JDBC driver as in (1), this property will define the class to use for creating the data source.

If you want to know all the properties supported for creating a xa-data-source, using jboss-cli.sh 

/subsystem=datasources/xa-data-source=foo:add( <TAB>

or for driver
/subsystem=datasources/data-source=foo:add( <TAB>

so it all comes down to how you are deploying the JAR file, that defines later actions.

HTH

Ramesh..


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



More information about the wildfly-dev mailing list