JBoss.org Community Documentation

13.2.1. Installing the JDBC Driver and Deploying the datasource

To make the JDBC driver classes available to the JBoss Application Server, copy the archive mysql-mysql-connector-java-5.1.5-bin.jar from the Connector/J distribution to the lib directory in the default server configuration (assuming that is the server configuration you’re running).

Then create a text file in the deploy directory called mysql-ds.xml with the following datasource descriptor:

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
	<local-tx-datasource>
	<jndi-name>DefaultDS</jndi-name>
	<connection-url>jdbc:mysql://localhost:3306/test</connection-url>
	<driver-class>com.mysql.jdbc.Driver</driver-class>
	<user-name>root</user-name>
	<password>jboss</password>
	<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
	<metadata>
	<type-mapping>mySQL</type-mapping>
	</metadata>
	</local-tx-datasource>
</datasources>

The datasource is pointing at the database called test provided by default with MySQL 5.x. Remember to update the connection url attributes as well as the combo username/password to match your environment setup.