Skip to content

Instantly share code, notes, and snippets.

@ribasco
Last active July 21, 2023 04:37
Show Gist options
  • Save ribasco/a2d4503fd3e393a21e6d1211a0664dda to your computer and use it in GitHub Desktop.
Save ribasco/a2d4503fd3e393a21e6d1211a0664dda to your computer and use it in GitHub Desktop.
How to install a mysql connector in Wildfly 10
  1. Download connector jar from mysql http://dev.mysql.com/downloads/connector/j/

  2. Unzip the downloaded file and copy the file mysql-connector-java-*-bin.jar to the new folder

WILDFLY_HOME/modules/system/layers/base/com/mysql/main

  1. create the file module.xml in the same folder with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<resources>
   <resource-root path="mysql-connector-java-<version here>-bin.jar"/>
</resources>
<dependencies>
  <module name="javax.api"/>
  <module name="javax.transaction.api"/>
</dependencies>
</module>
  1. Connect to console via jboss-cli and type
/subsystem=datasources/jdbc-driver=mysql:add(
  driver-name=mysql,
  driver-module-name=com.mysql,
  driver-class-name=com.mysql.jdbc.Driver
)
  1. Follow example jndi name when creating a new datasource

java:jboss/datasources/<app name>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment