Recently installed a jboss-as-web-7.0.2.Final, now will configure the mysql Data Source process records as follows:
1. Add the Mysql driver File
Copy the mysql driver file mysql-connector-java-5.1.18-bin.jar to the/modules/com/mysql/main/directory (/mysql/main/these two levels of folders need to be created by yourself, originally not)
2. Create a module. xml file
/Modules/com/mysql/main/module. xml contains the following content:
- <?Xml Version="1.0" Encoding=UTF-8"?>
- <Module Xmlns="Urn: jboss: module: 1.0" Name="Com. mysql">
- <Resources>
- <Resource-root Path=Mysql-connector-java-5.1.17-bin.jar"/>
- </Resources>
- <Dependencies>
- <Module Name="Javax. api"/>
- </Dependencies>
- </Module>
3. modify the configuration file
Edit the/standalone/configuration/standalone. xml file
Add the following 2-4 items to the drivers block of datasources:
- <Drivers>
- <Driver Name="Com. mysql" Module="Com. mysql">
- <Xa-datasource-class>Com. mysql. jdbc. jdbc2.optional. MysqlXADataSource</Xa-datasource-class>
- </Driver>
- </Drivers>
4. Configure the data source
Method 1: directly edit the standalone. xml file
Add the following content to the datasources block: 2-15
- <Datasources>
- <Datasource Jndi-name="Java: jboss/datasources/MysqlDS" Pool-name="MysqlDS">
- <Connection-url>Jdbc: mysql: // localhost: 3306/msqlDB</Connection-url>
- <Driver>Com. mysql</Driver>
- <Transaction-isolation>TRANSACTION_READ_COMMITTED</Transaction-isolation>
- <Pool>
- <Min-pool-size>10</Min-pool-size>
- <Max-pool-size>100</Max-pool-size>
- <Prefill>True</Prefill>
- </Pool>
- <Security>
- <User-name>User Name</User-name>
- <Password>Password</Password>
- </Security>
- </Datasource>
- </Datasources>
The second method is to log on to the jboss web console through http: // localhost: 9990/console and follow the prompts on the page to configure.