Questo contenuto non è disponibile nella lingua selezionata.
8.6. Create an XA Datasource with the Management Interfaces
This topic covers the steps required to create an XA datasource, using either the Management Console or the Management CLI.
Note
Procedure 8.4. Create an XA Datasource, Using Either the Management CLI or the Management Console
Management CLI
- Run the following Management CLI command to create an XA datasource, configuring the variables as appropriate:
Note
The value for DRIVER_NAME depends on the number of classes listed in the/META-INF/services/java.sql.Driverfile located in the JDBC driver JAR. If there is only one class, the value is the name of the JAR. If there are multiple classes, the value is the name of the JAR + driverClassName + "_" + majorVersion +"_" + minorVersion. Failure to do so will result in the following error being logged:JBAS014775: New missing/unsatisfied dependencies
JBAS014775: New missing/unsatisfied dependenciesCopy to Clipboard Copied! Toggle word wrap Toggle overflow For example, the DRIVER_NAME value required for the MySQL 5.1.31 driver, ismysql-connector-java-5.1.31-bin.jarcom.mysql.jdbc.Driver_5_1.xa-data-source add --name=XA_DATASOURCE_NAME --jndi-name=JNDI_NAME --driver-name=DRIVER_NAME --xa-datasource-class=XA_DATASOURCE_CLASS
xa-data-source add --name=XA_DATASOURCE_NAME --jndi-name=JNDI_NAME --driver-name=DRIVER_NAME --xa-datasource-class=XA_DATASOURCE_CLASSCopy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the XA datasource properties
Set the server name
Run the following command to configure the server name for the host:/subsystem=datasources/xa-data-source=XA_DATASOURCE_NAME/xa-datasource-properties=ServerName:add(value=HOSTNAME)
/subsystem=datasources/xa-data-source=XA_DATASOURCE_NAME/xa-datasource-properties=ServerName:add(value=HOSTNAME)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the database name
Run the following command to configure the database name:/subsystem=datasources/xa-data-source=XA_DATASOURCE_NAME/xa-datasource-properties=DatabaseName:add(value=DATABASE_NAME)
/subsystem=datasources/xa-data-source=XA_DATASOURCE_NAME/xa-datasource-properties=DatabaseName:add(value=DATABASE_NAME)Copy to Clipboard Copied! Toggle word wrap Toggle overflow
- Enable the datasource:
xa-data-source enable --name=XA_DATASOURCE_NAME
xa-data-source enable --name=XA_DATASOURCE_NAMECopy to Clipboard Copied! Toggle word wrap Toggle overflow
Management Console
Navigate to the Datasources panel in the Management Console
- Select the Configuration tab from the top of the console.
- For Domain mode only, select a profile from the drop-down box at the top left.
- Expand the menu on the left of the console, then expand the menu.
- Select .
- Select the XA Datasource tab.
Create a new XA datasource
- Click .
- Enter the new XA datasource attributes in the Create XA Datasource wizard and click .
- Enter the JDBC driver details in the Create XA Datasource wizard and click .
- Enter the XA properties and click .
- Enter the connection settings in the Create XA Datasource wizard.
- Click the button to test the connection to the XA datasource and verify the settings are correct.
- Click to finish
The XA datasource has been added to the server. It is now visible in either the standalone.xml or domain.xml file, as well as the management interfaces.