Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure Wildfily 12 or JBoss with MySQL Connector /J 8?

I got this to finally connect after reading old documentation. I am not sure if this is the best way, so if you have suggestions for better connection strings or wildfly pool settings please post.

like image 595
pitchblack408 Avatar asked Jan 25 '26 14:01

pitchblack408


1 Answers

Enter in the file path ${EAP_HOME}/modules/system/layers/base and create the directories com/mysql/driver8/main.

Into the folder main copy the driver(mysql-connector-java-8.0.11.jar) library jar, and create a file module.xml as showed in the sample below

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql.driver8">
  <resources>
    <resource-root path="mysql-connector-java-8.0.11.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
  </dependencies>
</module>

Then go to /wildfly-12.0.0.Final/standalone/standalone.xml copy and paste this into

            <datasource jndi-name="java:jboss/MySqlDS8" pool-name="MySqlDS8">
                <connection-url>jdbc:mysql://localhost:3306/mysql?useSSL=false&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;useJDBCCompliantTimezoneShift=true&amp;useLegacyDatetimeCode=false&amp;serverTimezone=UTC</connection-url>
                <driver>mysql8</driver>
                <security>
                    <user-name>root</user-name>
                    <password>12341234</password>
                </security>
                <validation>
                    <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
                    <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
                </validation>
            </datasource>

Then go to the section and copy and paste this.

   <driver name="mysql8" module="com.mysql.driver8">
       <xa-datasource-class>com.mysql.cj.jdbc.MysqlDataSource</xa-datasource-class>
   </driver>
like image 152
pitchblack408 Avatar answered Jan 27 '26 03:01

pitchblack408



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!