Skip to content

Instantly share code, notes, and snippets.

@friek
Last active January 1, 2016 18:59
Show Gist options
  • Select an option

  • Save friek/8187681 to your computer and use it in GitHub Desktop.

Select an option

Save friek/8187681 to your computer and use it in GitHub Desktop.
jboss-as7-mysql-ds.xml is part of the standalone.xml in which the MySQL datasource is defined. module.xml is the XML file necessary for configuring the MySQL connector module for JBoss AS 7.1.1. This file needs to be stored in $JBOSS_HOME/modules/com/mysql/main along with mysql-connector-java-5.1.25.jar.
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/MySQLDS" pool-name="MySQLDS" enabled="true">
<connection-url>jdbc:mysql://*hostname*:3306/*dbname*?characterEncoding=UTF-8</connection-url>
<driver>com.mysql</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>2</min-pool-size>
<max-pool-size>10</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>*username*</user-name>
<password>*password*</password>
</security>
<validation>
<check-valid-connection-sql>select 1</check-valid-connection-sql>
</validation>
<statement>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</datasource>
<drivers>
<driver name="com.mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.25.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment