Datasources (non-XA) - for applications that do not use transactions or use transactions with a single database
XA datasources - transactions are distributed across multiple databases
provided at "java:jboss/datasources/ExampleDS"
(not recommended for production environments)
*-ds.xml in deployment directory, not required but supported.
Install with management console:
Preferred method: install as a core module
EAP_HOME/docs/schema/module-1_2.xsd
)Example:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.15.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
/subsystem=datasources/jdbc-driver=DRIVER_NAME:add(driver-name=DRIVER_NAME,driver-module-name=MODULE_NAME,driver-xa-datasource-class-name=XA_DATASOURCE_CLASS_NAME)
/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)
With CLI:
data-source add --name=DATASOURCE_NAME --jndi-name=JNDI_NAME --driver-name=DRIVER_NAME --connection-url=CONNECTION_URL
data-source enable --name=DATASOURCE_NAME
Management Console:
Profile -> Datasources
Preferred solution is either Security Domain or Password Vaults, further study needed
(see transaction subsystem)
For standalone server:
edit EAP_HOME/standalone/configuration/standalone.xml, locate <datasource> tag and add / change attribute jta="true", restart server
Or use management console
Very detailed other properties and samples for popular databases are provided in the reference