In my case I use wildfly
, I did the following:
I configured the following entries in the standalone.xml file :
In <datasources
I added:
<datasource jndi-name="java:jboss/datasources/pokemax" pool-name="pokemax" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/banco?useTimezone=true&serverTimezone=UTC</connection-url>
<driver>mysql</driver>
<security>
<user-name>user</user-name>
<password>senha</password>
</security>
</datasource>
In <drivers
:
<driver name="mysql" module="com.mysql">
<driver-class>com.mysql.jdbc.Driver</driver-class>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
And add the mysql
driver to the directory: /opt/wildfly-10.1.0.Final/modules/system/layers/base/com/mysql/main .
If folders do not exist you can create them normally.
In this directory, add a file named module.xml with the following information:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-6.0.4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
Okay, just look at your settings like bank, user, password, mysql driver version, etc.