Defining a new datasource
Let's start this step by creating a datasource, providing basic configuration settings such as:
Its name
The JNDI name - used by the application to reference it
The connection URL to the database we want to connect to
The credentials to access the database (username and password)
The driver to use
Connect to the CLI and do as follows:
data-source add --name=MySQLDS --driver-name=mysql --user-name=root --password=root --connection-url="jdbc:mysql://192.168.59.104:3306/mysql?autoReconnect=true&useSSL=false" --jndi-name=java:jboss/MySQLDS
The preceding command should have added the datasource definition inside the standalone.xml
file. Here it is for reference:
<datasource jndi-name="java:jboss/MySQLDS" pool-name="MySQLDS"> <connection-url>jdbc:mysql://192.168.59.104:3306/mysql?autoReconnect=true&useSSL=false</connection-url> <driver>mysql</driver> <security> <user-name>root<...