Chapter 6. Datasource Management
6.1.1. About JDBC
The JDBC API is the standard that defines how databases are accessed by Java applications. An application configures a datasource that references a JDBC driver. Application code can then be written against the driver, rather than the database. The driver converts the code to the database language. This means that if the correct driver is installed, an application can be used with any supported database.
The JDBC 4.0 specification is defined here: http://jcp.org/en/jsr/detail?id=221.
Procedure 6.1. Test datasource pools connection using Management Console
- Select the Runtime tab from the top of the Management Console.
- Expand the Subsystems menu on the left, and select Datasources.
- Click the Test Connection button to test the connection to the datasource and verify the settings are correct.
Procedure 6.2. Test datasource connection using Management CLI
- Launch the CLI tool and connect to your server.
- Run the following Management CLI command to test the connection:
- In Standalone mode, enter the following command:
- In Domain mode, enter the following command:
To get started with JDBC and datasources, refer to the JDBC Driver section of the Administration and Configuration Guide for JBoss EAP 6.
6.1.2. JBoss EAP 6 Supported Databases
The list of JDBC compliant databases supported by JBoss EAP 6 is available here: https://access.redhat.com/articles/111663.
6.1.3. Types of Datasources
The two general types of resources are referred to as
Non-XA datasources are used for applications which do not use transactions, or applications which use transactions with a single database.
XA datasources are used by applications whose transactions are distributed across multiple databases. XA datasources introduce additional overhead.
You specify the type of your datasource when you create it in the Management Console or Management CLI.
6.1.4. The Example Datasource
JBoss EAP 6 includes a H2 database. It is a lightweight, relational database management system that provides developers with the ability to quickly build applications, and is the example datasource for the platform.
However, it should not be used in a production environment. It is a very small, self-contained datasource that supports all of the standards needed for testing and building applications, but is not robust or scalable enough for production use.
For a list of supported and certified datasources, refer here: Section 6.1.2, “JBoss EAP 6 Supported Databases”.
6.1.5. Deployment of -ds.xml files
In JBoss EAP 6, datasources are defined as a resource of the server subsystem. In previous versions, a
*-ds.xmldatasource configuration file was required in the deployment directory of the server configuration.
*-ds.xmlfiles can still be deployed in JBoss EAP 6, following the 1.1 data sources schema available under Schemas here: http://www.ironjacamar.org/documentation.html.
This feature should only be used for development. It is not recommended for production environments because it is not supported by the JBoss administrative and management tools. This feature is deprecated in JBoss EAP 6.4 and will not be supported in the next major release of the product.
It is mandatory to use a reference to an already deployed / defined <driver> entry when deploying