One of the most used features that an application comes with is the possibility to persist states (such as user information, orders, and so on) into a database. In this recipe, we will learn how to configure datasources and a JDBC 4 compliant driver.
Before we begin, we need to have a running database installed on our computer, or on a remote server. In this recipe, we will use a MySQL database running locally and listening on port 3306
—the installation and configuration of the MySQL database server is beyond the scope of this book.
Declaring a new datasource consists of two separate steps:
Installing the JDBC driver.
Configuring the datasource itself.
The first step can be done in two different ways. You can install a JDBC driver by deploying it as a normal artifact, or you can install it as a WildFly module.
First, download the latest version (which, as per this writing, is "5.1.35") of the MySQL JDBC connector from http://dev.mysql.com/downloads...