No matter how you’re running your application server, one of the first configuration changes you do is likely the addition of a datasource. In this post, we show how to do it with CLI on WildFly, using MySQL.

The examples in this post assume there is a WildFly instance running on its default localhost:8080 and the management interface is listening on its default localhost:9990. A MySQL instance is assumed to be running and listening on its default localhost:3306. A database mydb exists and a user myuser with his password password has been granted access.

Let’s start by downloading the appropriate version of MySQL JDBC driver (e.g. 5.1.32):

$ wget -q "http://search.maven.org/remotecontent?filepath=mysql/mysql-\
connector-java/5.1.32/mysql-connector-java-5.1.32.jar" -O mysql-connector-java.jar

Subsequently, we start the CLI:

$JBOSS_HOME/bin/jboss-cli.sh -c

We install the JDBC driver:

[standalone@localhost:9990 /] module add --name=com.mysql\
  --resources=mysql-connector-java.jar\
  --dependencies=javax.api,javax.transaction.api
[standalone@localhost:9990 /] /subsystem=datasources/jdbc-driver=mysql:\
  add(driver-name=mysql,driver-module-name=com.mysql,\
  driver-xa-datasource-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource)
{"outcome" => "success"}

Next, we create a new datasource:

[standalone@localhost:9990 /] data-source add --name=MySqlDS\
  --driver-name=mysql --jndi-name=java:jboss/datasources/MySqlDS\
  --connection-url=jdbc:mysql://localhost:3306/mydb --user-name=myuser\
  --password=password --enabled=true

If you’re using global (distributed) transactions, execute the following to create an XA datasource:

[standalone@localhost:9990 /] xa-data-source add --name=XAMySqlDS\
  --driver-name=mysql --jndi-name=java:jboss/datasources/XAMySqlDS\
  --user-name=myuser --password=password --xa-datasource-properties={\
    "ServerName" => "localhost", "PortNumber" => "3306",\
    "DatabaseName" => "mydb"}\
  --xa-datasource-class=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource\
  --valid-connection-checker-class-name=org.jboss.resource.adapter.jdbc.\
    vendor.MySQLValidConnectionChecker\
  --exception-sorter-class-name=org.jboss.resource.adapter.jdbc.vendor.\
    MySQLExceptionSorter --enabled=true

Note that the data-source add and xa-data-source add examples above are not minimal in the sense of specifying the required arguments only, they also include optional arguments you’ll most likely want to specify. Other arguments I frequently use are jta, use-ccm, max-pool-size, blocking-timeout-wait-millis, and prepared-statements-cache-size (explained below).

Notice how non-XA and XA datasources are added via different commands using different sets of parameters:

Non-XA datasources:

[standalone@localhost:9990 /] data-source add --help

DESCRIPTION:

  Add a new data-source


REQUIRED ARGUMENTS:

 --name                 - Required argument in commands which identifies
                          the instance to execute the command against.

 --connection-url       - (STRING) The JDBC driver connection URL

 --driver-name          - (STRING) Defines the JDBC driver the datasource
                          should use. It is a symbolic name matching the
                        the name of installed driver. In case the driver is
                        deployed as jar, the name is the name of deployment
                        unit

 --jndi-name            - (STRING) Specifies the JNDI name for the
                          datasource



OPTIONAL ARGUMENTS:

 --allocation-retry     - (INT) The allocation retry element indicates the
                          number of times that allocating a connection
                        should be tried before throwing an exception

 --allocation-retry-wait-millis  - (LONG) The allocation retry wait millis
                                   element specifies the amount of time, in
                        milliseconds, to wait between retrying to allocate
                        a connection

 --allow-multiple-users  - (BOOLEAN) 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

 --background-validation  - (BOOLEAN) An element to specify that
                            connections should be validated on a background
                        thread versus being validated prior to use.
                        Changing this value can be done only on disabled
                        datasource,  requires a server restart otherwise.

 --background-validation-millis  - (LONG) The background-validation-millis
                                   element specifies the amount of time, in
                        milliseconds, that background validation will run.
                        Changing this value can be done only on disabled
                        datasource,  requires a server restart otherwise

 --blocking-timeout-wait-millis  - (LONG) The blocking-timeout-millis
                                   element specifies the maximum time, in
                        milliseconds, to block while waiting for a
                        connection before throwing an exception. Note that
                        this blocks only while waiting for locking a
                        connection, and will never throw an exception if
                        creating a new connection takes an inordinately
                        long time

 --capacity-decrementer-class  - (STRING) Class defining the policy for
                                 decrementing connections in the pool

 --capacity-decrementer-properties  - (OBJECT) Properties to be injected in
                                      class defining the policy for
                        decrementing connections in the pool

 --capacity-incrementer-class  - (STRING) Class defining the policy for
                                 incrementing connections in the pool

 --capacity-incrementer-properties  - (OBJECT) Properties to be injected in
                                      class defining the policy for
                        incrementing connections in the pool

 --check-valid-connection-sql  - (STRING) Specify an SQL statement to check
                                 validity of a pool connection. This may be
                        called when managed connection is obtained from the
                        pool

 --connectable          - (BOOLEAN) Enable the use of CMR. This feature
                          means that a local resource can reliably
                        participate in an XA transaction.

 --connection-listener-class  - (STRING) Speciefies class name extending
                                org.jboss.jca.adapters.jdbc.spi.listener.Co
                        nnectionListener that provides a possible to listen
                        for connection activation and passivation in order
                        to perform actions before the connection is
                        returned to the application or returned to the
                        pool.

 --connection-listener-property  - (OBJECT) Properties to be injected in
                                   class specidied in
                        connection-listener-class

 --datasource-class     - (STRING) The fully qualified name of the JDBC
                          datasource class

 --driver-class         - (STRING) The fully qualified name of the JDBC
                          driver class

 --enabled              - (BOOLEAN) Specifies if the datasource should be
                          enabled. Note this attribute will not be
                        supported runtime in next versions.

 --enlistment-trace     - (BOOLEAN) Defines if WildFly/IronJacamar should
                          record enlistment traces

 --exception-sorter-class-name  - (STRING) An
                                  org.jboss.jca.adapters.jdbc.ExceptionSort
                        er that provides an isExceptionFatal(SQLException)
                        method to validate if an exception should broadcast
                        an error

 --exception-sorter-properties  - (OBJECT) The exception sorter properties

 --flush-strategy       - (STRING) Specifies how the pool should be flush
                          in case of an error. Valid values are:
                        FailingConnectionOnly (default), IdleConnections
                        and EntirePool

 --idle-timeout-minutes  - (LONG) The idle-timeout-minutes elements
                           specifies the maximum time, in minutes, a
                        connection may be idle before being closed. The
                        actual maximum time depends also on the IdleRemover
                        scan time, which is half of the smallest
                        idle-timeout-minutes value of any pool. Changing
                        this value can be done only on disabled datasource,
                        requires a server restart otherwise.

 --initial-pool-size    - (INT) The initial-pool-size element indicates the
                          initial number of connections a pool should hold.

 --jta                  - (BOOLEAN) Enable JTA integration

 --max-pool-size        - (INT) The max-pool-size element specifies the
                          maximum number of connections for a pool. No more
                        connections will be created in each sub-pool

 --mcp                  - (STRING) Defines the ManagedConnectionPool
                          implementation, f.ex.
                        org.jboss.jca.core.connectionmanager.pool.mcp.Semap
                        horeArrayListManagedConnectionPool

 --min-pool-size        - (INT) The min-pool-size element specifies the
                          minimum number of connections for a pool

 --new-connection-sql   - (STRING) Specifies an SQL statement to execute
                          whenever a connection is added to the connection
                        pool

 --password             - (STRING) Specifies the password used when
                          creating a new connection

 --pool-fair            - (BOOLEAN) Defines if pool should use be fair

 --pool-prefill         - (BOOLEAN) Should the pool be prefilled. Changing
                          this value can be done only on disabled
                        datasource, requires a server restart otherwise.

 --pool-use-strict-min  - (BOOLEAN) Specifies if the min-pool-size should
                          be considered strictly

 --prepared-statements-cache-size  - (LONG) The number of prepared
                                     statements per connection in an LRU
                        cache

 --query-timeout        - (LONG) Any configured query timeout in seconds.
                          If not provided no timeout will be set

 --reauth-plugin-class-name  - (STRING) The fully qualified class name of
                               the reauthentication plugin implementation

 --reauth-plugin-properties  - (OBJECT) The properties for the
                               reauthentication plugin

 --security-domain      - (STRING) Specifies the security domain which
                          defines the javax.security.auth.Subject that are
                        used to distinguish connections in the pool

 --set-tx-query-timeout  - (BOOLEAN) Whether to set the query timeout based
                           on the time remaining until transaction timeout.
                        Any configured query timeout will be used if there
                        is no transaction

 --share-prepared-statements  - (BOOLEAN) Whether to share prepared
                                statements, i.e. whether asking for same
                        statement twice without closing uses the same
                        underlying prepared statement

 --spy                  - (BOOLEAN) Enable spying of SQL statements

 --stale-connection-checker-class-name  - (STRING) An
                                          org.jboss.jca.adapters.jdbc.Stale
                        ConnectionChecker that provides an
                        isStaleConnection(SQLException) method which if it
                        returns true will wrap the exception in an
                        org.jboss.jca.adapters.jdbc.StaleConnectionExceptio
                        n

 --stale-connection-checker-properties  - (OBJECT) The stale connection
                                          checker properties

 --statistics-enabled   - (BOOLEAN) define if runtime statistics is enabled
                          or not.

 --track-statements     - (STRING) Whether to check for unclosed statements
                          when a connection is returned to the pool, result
                        sets are closed, a statement is closed or return to
                        the prepared statement cache. Valid values are:
                        "false" - do not track statements, "true" - track
                        statements and result sets and warn when they are
                        not closed, "nowarn" - track statements but do not
                        warn about them being unclosed

 --tracking             - (BOOLEAN) Defines if IronJacamar should track
                          connection handles across transaction boundaries

 --transaction-isolation  - (STRING) Set the java.sql.Connection
                            transaction isolation level. Valid values are:
                        TRANSACTION_READ_UNCOMMITTED,
                        TRANSACTION_READ_COMMITTED,
                        TRANSACTION_REPEATABLE_READ,
                        TRANSACTION_SERIALIZABLE and TRANSACTION_NONE

 --url-delimiter        - (STRING) Specifies the delimiter for URLs in
                          connection-url for HA datasources

 --url-selector-strategy-class-name  - (STRING) A class that implements
                                       org.jboss.jca.adapters.jdbc.URLSelec
                        torStrategy

 --use-ccm              - (BOOLEAN) Enable the use of a cached connection
                          manager

 --use-fast-fail        - (BOOLEAN) Whether to fail a connection allocation
                          on the first try if it is invalid (true) or keep
                        trying until the pool is exhausted of all potential
                        connections (false)

 --use-java-context     - (BOOLEAN) Setting this to false will bind the
                          datasource into global JNDI

 --use-try-lock         - (LONG) Any configured timeout for internal locks
                          on the resource adapter objects in seconds

 --user-name            - (STRING) Specify the user name used when creating
                          a new connection

 --valid-connection-checker-class-name  - (STRING) An
                                          org.jboss.jca.adapters.jdbc.Valid
                        ConnectionChecker that provides an
                        isValidConnection(Connection) method to validate a
                        connection. If an exception is returned that means
                        the connection is invalid. This overrides the
                        check-valid-connection-sql element

 --valid-connection-checker-properties  - (OBJECT) The valid connection
                                          checker properties

 --validate-on-match    - (BOOLEAN) The validate-on-match element specifies
                          if connection validation should be done when a
                        connection factory attempts to match a managed
                        connection. This is typically exclusive to the use
                        of background validation

XA datasources:

[standalone@localhost:9990 /] xa-data-source add --help

DESCRIPTION:

  Add a new XA data-source (unlike the add operation, this command accepts
  xa-datasource-properties).


REQUIRED ARGUMENTS:

 --name                 - Required argument in commands which identifies
                          the instance to execute the command against.

 --driver-name          - (STRING) Defines the JDBC driver the datasource
                          should use. It is a symbolic name matching the
                        the name of installed driver. In case the driver is
                        deployed as jar, the name is the name of deployment
                        unit

 --jndi-name            - (STRING) Specifies the JNDI name for the
                          datasource



OPTIONAL ARGUMENTS:

 --allocation-retry     - (INT) The allocation retry element indicates the
                          number of times that allocating a connection
                        should be tried before throwing an exception

 --allocation-retry-wait-millis  - (LONG) The allocation retry wait millis
                                   element specifies the amount of time, in
                        milliseconds, to wait between retrying to allocate
                        a connection

 --allow-multiple-users  - (BOOLEAN) 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

 --background-validation  - (BOOLEAN) An element to specify that
                            connections should be validated on a background
                        thread versus being validated prior to use.
                        Changing this value can be done only on disabled
                        datasource,  requires a server restart otherwise.

 --background-validation-millis  - (LONG) The background-validation-millis
                                   element specifies the amount of time, in
                        milliseconds, that background validation will run.
                        Changing this value can be done only on disabled
                        datasource,  requires a server restart otherwise

 --blocking-timeout-wait-millis  - (LONG) The blocking-timeout-millis
                                   element specifies the maximum time, in
                        milliseconds, to block while waiting for a
                        connection before throwing an exception. Note that
                        this blocks only while waiting for locking a
                        connection, and will never throw an exception if
                        creating a new connection takes an inordinately
                        long time

 --capacity-decrementer-class  - (STRING) Class defining the policy for
                                 decrementing connections in the pool

 --capacity-decrementer-properties  - (OBJECT) Properties to inject in
                                      class defining the policy for
                        decrementing connections in the pool

 --capacity-incrementer-class  - (STRING) Class defining the policy for
                                 incrementing connections in the pool

 --capacity-incrementer-properties  - (OBJECT) Properties to inject in
                                      class defining the policy for
                        incrementing connections in the pool

 --check-valid-connection-sql  - (STRING) Specify an SQL statement to check
                                 validity of a pool connection. This may be
                        called when managed connection is obtained from the
                        pool

 --connectable          - (BOOLEAN) Enable the use of CMR for this
                          datasource. This feature means that a local
                        resource can reliably participate in an XA
                        transaction.

 --connection-listener-class  - (STRING) Speciefies class name extending
                                org.jboss.jca.adapters.jdbc.spi.listener.Co
                        nnectionListener that provides a possible to listen
                        for connection activation and passivation in order
                        to perform actions before the connection is
                        returned to the application or returned to the
                        pool.

 --connection-listener-property  - (OBJECT) Properties to be injected in
                                   class specified in
                        connection-listener-class

 --enabled              - (BOOLEAN) Specifies if the datasource should be
                          enabled. Note this attribute will not be
                        supported runtime in next versions.

 --enlistment-trace     - (BOOLEAN) Defines if WildFly/IronJacamar should
                          record enlistment traces

 --exception-sorter-class-name  - (STRING) An
                                  org.jboss.jca.adapters.jdbc.ExceptionSort
                        er that provides an isExceptionFatal(SQLException)
                        method to validate if an exception should broadcast
                        an error

 --exception-sorter-properties  - (OBJECT) The exception sorter properties

 --flush-strategy       - (STRING) Specifies how the pool should be flush
                          in case of an error. Valid values are:
                        FailingConnectionOnly (default), IdleConnections
                        and EntirePool

 --idle-timeout-minutes  - (LONG) The idle-timeout-minutes elements
                           specifies the maximum time, in minutes, a
                        connection may be idle before being closed. The
                        actual maximum time depends also on the IdleRemover
                        scan time, which is half of the smallest
                        idle-timeout-minutes value of any pool. Changing
                        this value can be done only on disabled datasource,
                        requires a server restart otherwise.

 --initial-pool-size    - (INT) The initial-pool-size element indicates the
                          initial number of connections a pool should hold.

 --interleaving         - (BOOLEAN) An element to enable interleaving for
                          XA connections

 --max-pool-size        - (INT) The max-pool-size element specifies the
                          maximum number of connections for a pool. No more
                        connections will be created in each sub-pool

 --mcp                  - (STRING) Defines the ManagedConnectionPool
                          implementation, f.ex.
                        org.jboss.jca.core.connectionmanager.pool.mcp.Semap
                        horeArrayListManagedConnectionPool

 --min-pool-size        - (INT) The min-pool-size element specifies the
                          minimum number of connections for a pool

 --new-connection-sql   - (STRING) Specifies an SQL statement to execute
                          whenever a connection is added to the connection
                        pool

 --no-recovery          - (BOOLEAN) Specifies if the connection pool should
                          be excluded from recovery

 --no-tx-separate-pool  - (BOOLEAN) Oracle does not like XA connections
                          getting used both inside and outside a JTA
                        transaction. To workaround the problem you can
                        create separate sub-pools for the different
                        contexts

 --pad-xid              - (BOOLEAN) Should the Xid be padded

 --password             - (STRING) Specifies the password used when
                          creating a new connection

 --pool-fair            - (BOOLEAN) Defines if pool should use be fair

 --pool-prefill         - (BOOLEAN) Should the pool be prefilled. Changing
                          this value can be done only on disabled
                        datasource, requires a server restart otherwise.

 --pool-use-strict-min  - (BOOLEAN) Specifies if the min-pool-size should
                          be considered strictly

 --prepared-statements-cache-size  - (LONG) The number of prepared
                                     statements per connection in an LRU
                        cache

 --query-timeout        - (LONG) Any configured query timeout in seconds.
                          If not provided no timeout will be set

 --reauth-plugin-class-name  - (STRING) The fully qualified class name of
                               the reauthentication plugin implementation

 --reauth-plugin-properties  - (OBJECT) The properties for the
                               reauthentication plugin

 --recovery-password    - (STRING) The password used for recovery

 --recovery-plugin-class-name  - (STRING) The fully qualified class name of
                                 the recovery plugin implementation

 --recovery-plugin-properties  - (OBJECT) The properties for the recovery
                                 plugin

 --recovery-security-domain  - (STRING) The security domain used for
                               recovery

 --recovery-username    - (STRING) The user name used for recovery

 --same-rm-override     - (BOOLEAN) The is-same-rm-override element allows
                          one to unconditionally set whether the
                        javax.transaction.xa.XAResource.isSameRM(XAResource
                        ) returns true or false

 --security-domain      - (STRING) Specifies the security domain which
                          defines the javax.security.auth.Subject that are
                        used to distinguish connections in the pool

 --set-tx-query-timeout  - (BOOLEAN) Whether to set the query timeout based
                           on the time remaining until transaction timeout.
                        Any configured query timeout will be used if there
                        is no transaction

 --share-prepared-statements  - (BOOLEAN) Whether to share prepared
                                statements, i.e. whether asking for same
                        statement twice without closing uses the same
                        underlying prepared statement

 --spy                  - (BOOLEAN) Enable spying of SQL statements

 --stale-connection-checker-class-name  - (STRING) An
                                          org.jboss.jca.adapters.jdbc.Stale
                        ConnectionChecker that provides an
                        isStaleConnection(SQLException) method which if it
                        returns true will wrap the exception in an
                        org.jboss.jca.adapters.jdbc.StaleConnectionExceptio
                        n

 --stale-connection-checker-properties  - (OBJECT) The stale connection
                                          checker properties

 --statistics-enabled   - (BOOLEAN) define if runtime statistics is enabled
                          or not

 --track-statements     - (STRING) Whether to check for unclosed statements
                          when a connection is returned to the pool, result
                        sets are closed, a statement is closed or return to
                        the prepared statement cache. Valid values are:
                        "false" - do not track statements, "true" - track
                        statements and result sets and warn when they are
                        not closed, "nowarn" - track statements but do not
                        warn about them being unclosed

 --tracking             - (BOOLEAN) Defines if IronJacamar should track
                          connection handles across transaction boundaries

 --transaction-isolation  - (STRING) Set the java.sql.Connection
                            transaction isolation level. Valid values are:
                        TRANSACTION_READ_UNCOMMITTED,
                        TRANSACTION_READ_COMMITTED,
                        TRANSACTION_REPEATABLE_READ,
                        TRANSACTION_SERIALIZABLE and TRANSACTION_NONE

 --url-delimiter        - (STRING) Specifies the delimiter for URLs in
                          connection-url for HA datasources

 --url-property         - (STRING) Specifies the property for the URL
                          property in the xa-datasource-property values

 --url-selector-strategy-class-name  - (STRING) A class that implements
                                       org.jboss.jca.adapters.jdbc.URLSelec
                        torStrategy

 --use-ccm              - (BOOLEAN) Enable the use of a cached connection
                          manager

 --use-fast-fail        - (BOOLEAN) Whether to fail a connection allocation
                          on the first try if it is invalid (true) or keep
                        trying until the pool is exhausted of all potential
                        connections (false)

 --use-java-context     - (BOOLEAN) Setting this to false will bind the
                          datasource into global JNDI

 --use-try-lock         - (LONG) Any configured timeout for internal locks
                          on the resource adapter objects in seconds

 --user-name            - (STRING) Specify the user name used when creating
                          a new connection

 --valid-connection-checker-class-name  - (STRING) An
                                          org.jboss.jca.adapters.jdbc.Valid
                        ConnectionChecker that provides an
                        isValidConnection(Connection) method to validate a
                        connection. If an exception is returned that means
                        the connection is invalid. This overrides the
                        check-valid-connection-sql element

 --valid-connection-checker-properties  - (OBJECT) The valid connection
                                          checker properties

 --validate-on-match    - (BOOLEAN) The validate-on-match element specifies
                          if connection validation should be done when a
                        connection factory attempts to match a managed
                        connection. This is typically exclusive to the use
                        of background validation

 --wrap-xa-resource     - (BOOLEAN) Should the XAResource instances be
                          wrapped in an org.jboss.tm.XAResourceWrapper
                        instance

 --xa-datasource-class  - (STRING) The fully qualified name of the
                          javax.sql.XADataSource implementation

 --xa-resource-timeout  - (INT) The value is passed to
                          XAResource.setTransactionTimeout(), in seconds.
                        Default is zero

 --xa-datasource-properties  - (LIST) A comma-separated list of XA
                               datasource properties in key=value pair
                        format.

Now, let’s double-check that everything is set up correctly. We verify that both datasources exist:

[standalone@localhost:9990 /] /subsystem=datasources:read-resource
{
    "outcome" => "success",
    "result" => {
        "data-source" => {
            "ExampleDS" => undefined,
            "MySqlDS" => undefined
        },
        "jdbc-driver" => {
            "h2" => undefined,
            "mysql" => undefined
        },
        "xa-data-source" => {"XAMySqlDS" => undefined}
    }
}

Next, we make sure the connection can be established:

[standalone@localhost:9990 /] data-source test-connection-in-pool --name=MySqlDS
true
[standalone@localhost:9990 /] xa-data-source test-connection-in-pool --name=XAMySqlDS
true

For simple monitoring, we can run the following:

[standalone@localhost:9990 /] data-source read-resource --name=MySqlDS\
  --include-runtime=true --recursive=true
allocation-retry=n/a
allocation-retry-wait-millis=n/a
allow-multiple-users=false
background-validation=n/a
background-validation-millis=n/a
blocking-timeout-wait-millis=n/a
capacity-decrementer-class=n/a
capacity-decrementer-properties=n/a
capacity-incrementer-class=n/a
capacity-incrementer-properties=n/a
check-valid-connection-sql=n/a
connectable=false
connection-listener-class=n/a
connection-listener-property=n/a
connection-url=jdbc:mysql://localhost:3306/mydb
datasource-class=n/a
driver-class=n/a
driver-name=mysql
enabled=true
enlistment-trace=true
exception-sorter-class-name=n/a
exception-sorter-properties=n/a
flush-strategy=n/a
idle-timeout-minutes=n/a
initial-pool-size=n/a
jndi-name=java:jboss/datasources/MySqlDS
jta=true
max-pool-size=n/a
mcp=org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrent\
LinkedDequeManagedConnectionPool
min-pool-size=n/a
new-connection-sql=n/a
password=password
pool-fair=n/a
pool-prefill=n/a
pool-use-strict-min=n/a
prepared-statements-cache-size=n/a
query-timeout=n/a
reauth-plugin-class-name=n/a
reauth-plugin-properties=n/a
security-domain=n/a
set-tx-query-timeout=false
share-prepared-statements=false
spy=false
stale-connection-checker-class-name=n/a
stale-connection-checker-properties=n/a
statistics-enabled=false
track-statements=NOWARN
tracking=false
transaction-isolation=n/a
url-delimiter=n/a
url-selector-strategy-class-name=n/a
use-ccm=true
use-fast-fail=false
use-java-context=true
use-try-lock=n/a
user-name=myuser
valid-connection-checker-class-name=n/a
valid-connection-checker-properties=n/a
validate-on-match=n/a
connection-properties=n/a
statistics
  pool
    ActiveCount=0
    AvailableCount=0
    AverageBlockingTime=0L
    AverageCreationTime=0L
    AverageGetTime=0L
    AveragePoolTime=0L
    AverageUsageTime=0L
    BlockingFailureCount=0
    CreatedCount=0
    DestroyedCount=0
    IdleCount=0
    InUseCount=0
    MaxCreationTime=0L
    MaxGetTime=0L
    MaxPoolTime=0L
    MaxUsageTime=0L
    MaxUsedCount=0
    MaxWaitCount=0
    MaxWaitTime=0L
    TimedOut=0
    TotalBlockingTime=0L
    TotalCreationTime=0L
    TotalGetTime=0L
    TotalPoolTime=0L
    TotalUsageTime=0L
    WaitCount=0
    XACommitAverageTime=0L
    XACommitCount=0L
    XACommitMaxTime=0L
    XACommitTotalTime=0L
    XAEndAverageTime=0L
    XAEndCount=0L
    XAEndMaxTime=0L
    XAEndTotalTime=0L
    XAForgetAverageTime=0L
    XAForgetCount=0L
    XAForgetMaxTime=0L
    XAForgetTotalTime=0L
    XAPrepareAverageTime=0L
    XAPrepareCount=0L
    XAPrepareMaxTime=0L
    XAPrepareTotalTime=0L
    XARecoverAverageTime=0L
    XARecoverCount=0L
    XARecoverMaxTime=0L
    XARecoverTotalTime=0L
    XARollbackAverageTime=0L
    XARollbackCount=0L
    XARollbackMaxTime=0L
    XARollbackTotalTime=0L
    XAStartAverageTime=0L
    XAStartCount=0L
    XAStartMaxTime=0L
    XAStartTotalTime=0L
    statistics-enabled=false
  jdbc
    PreparedStatementCacheAccessCount=0L
    PreparedStatementCacheAddCount=0L
    PreparedStatementCacheCurrentSize=0
    PreparedStatementCacheDeleteCount=0L
    PreparedStatementCacheHitCount=0L
    PreparedStatementCacheMissCount=0L
    statistics-enabled=false
process-state: reload-required
[standalone@localhost:9990 /] xa-data-source read-resource --name=XAMySqlDS\
  --include-runtime=true --recursive=true
allocation-retry=n/a
allocation-retry-wait-millis=n/a
allow-multiple-users=false
background-validation=n/a
background-validation-millis=n/a
blocking-timeout-wait-millis=n/a
capacity-decrementer-class=n/a
capacity-decrementer-properties=n/a
capacity-incrementer-class=n/a
capacity-incrementer-properties=n/a
check-valid-connection-sql=n/a
connectable=false
connection-listener-class=n/a
connection-listener-property=n/a
driver-name=mysql
enabled=true
enlistment-trace=true
exception-sorter-class-name=org.jboss.resource.adapter.jdbc.vendor.\
MySQLExceptionSorter
exception-sorter-properties=n/a
flush-strategy=n/a
idle-timeout-minutes=n/a
initial-pool-size=n/a
interleaving=false
jndi-name=java:jboss/datasources/XAMySqlDS
max-pool-size=n/a
mcp=org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrent\
LinkedDequeManagedConnectionPool
min-pool-size=n/a
new-connection-sql=n/a
no-recovery=n/a
no-tx-separate-pool=false
pad-xid=false
password=password
pool-fair=n/a
pool-prefill=n/a
pool-use-strict-min=n/a
prepared-statements-cache-size=n/a
query-timeout=n/a
reauth-plugin-class-name=n/a
reauth-plugin-properties=n/a
recovery-password=n/a
recovery-plugin-class-name=n/a
recovery-plugin-properties=n/a
recovery-security-domain=n/a
recovery-username=n/a
same-rm-override=n/a
security-domain=n/a
set-tx-query-timeout=false
share-prepared-statements=false
spy=false
stale-connection-checker-class-name=n/a
stale-connection-checker-properties=n/a
statistics-enabled=false
track-statements=NOWARN
tracking=false
transaction-isolation=n/a
url-delimiter=n/a
url-property=n/a
url-selector-strategy-class-name=n/a
use-ccm=true
use-fast-fail=false
use-java-context=true
use-try-lock=n/a
user-name=myuser
valid-connection-checker-class-name=org.jboss.resource.adapter.jdbc.\
vendor.MySQLValidConnectionChecker
valid-connection-checker-properties=n/a
validate-on-match=n/a
wrap-xa-resource=true
xa-datasource-class=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
xa-resource-timeout=n/a
statistics
  pool
    ActiveCount=0
    AvailableCount=0
    AverageBlockingTime=0L
    AverageCreationTime=0L
    AverageGetTime=0L
    AveragePoolTime=0L
    AverageUsageTime=0L
    BlockingFailureCount=0
    CreatedCount=0
    DestroyedCount=0
    IdleCount=0
    InUseCount=0
    MaxCreationTime=0L
    MaxGetTime=0L
    MaxPoolTime=0L
    MaxUsageTime=0L
    MaxUsedCount=0
    MaxWaitCount=0
    MaxWaitTime=0L
    TimedOut=0
    TotalBlockingTime=0L
    TotalCreationTime=0L
    TotalGetTime=0L
    TotalPoolTime=0L
    TotalUsageTime=0L
    WaitCount=0
    XACommitAverageTime=0L
    XACommitCount=0L
    XACommitMaxTime=0L
    XACommitTotalTime=0L
    XAEndAverageTime=0L
    XAEndCount=0L
    XAEndMaxTime=0L
    XAEndTotalTime=0L
    XAForgetAverageTime=0L
    XAForgetCount=0L
    XAForgetMaxTime=0L
    XAForgetTotalTime=0L
    XAPrepareAverageTime=0L
    XAPrepareCount=0L
    XAPrepareMaxTime=0L
    XAPrepareTotalTime=0L
    XARecoverAverageTime=0L
    XARecoverCount=0L
    XARecoverMaxTime=0L
    XARecoverTotalTime=0L
    XARollbackAverageTime=0L
    XARollbackCount=0L
    XARollbackMaxTime=0L
    XARollbackTotalTime=0L
    XAStartAverageTime=0L
    XAStartCount=0L
    XAStartMaxTime=0L
    XAStartTotalTime=0L
    statistics-enabled=false
  jdbc
    PreparedStatementCacheAccessCount=0L
    PreparedStatementCacheAddCount=0L
    PreparedStatementCacheCurrentSize=0
    PreparedStatementCacheDeleteCount=0L
    PreparedStatementCacheHitCount=0L
    PreparedStatementCacheMissCount=0L
    statistics-enabled=false
xa-datasource-properties
  ServerName
    value=localhost
  PortNumber
    value=3306
  DatabaseName
    value=mydb

The examples in this post were tested using WildFly 10.0.0.Final and MySQL 5.7.13.