1 min read
  1. Copy the module.xml and mariadb-java-client.jar in JBoss modules base directory on the path /org/mariadb/main/
  2. Refer to the below sample for module.xml. Update the jar file name with your specific version.
<module xmlns="urn:jboss:module:1.1" name="org.mariadb">
    <resources>
        <resource-root path="mariadb-java-client-1.3.3.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>
  1. Refer to the below for datasource configuration in standalone.xml or the XML you use. Replace IP or hostname, port
    number, database name (DB1), pool name, JNDI name as per what you need.
<datasource jndi-name="java:jboss/MariaDBDS" pool-name="MariaDBDS" enabled="true" statistics-enabled="true">
    <connection-url>jdbc:mariadb://10.92.142.148:6603/DB1</connection-url>
    <driver>mariadb</driver>
    <new-connection-sql>SELECT 1</new-connection-sql>
    <security>
        <user-name>root</user-name>
        <password>athens</password>
    </security>
    <validation>
        <valid-connection-checker
                class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
        <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
        <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
    </validation>
</datasource>

Check to this part and update your connection pool.

  1. Add below this XML part in drivers
<driver name="mariadb" module="org.mariadb">
    <xa-datasource-class>org.mariadb.jdbc.MariaDbDataSource</xa-datasource-class>
</driver>
  1. Start JBoss and check datasources in the console and test the connection again.
Orestis Pantazos

Orestis Pantazos

DevOps Engineer