Jboss-as-web-7.0.2.Final-based MySQL Data Source Configuration

Source: Internet
Author: User

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:

  1. <?Xml Version="1.0" Encoding=UTF-8"?>
  2. <Module Xmlns="Urn: jboss: module: 1.0" Name="Com. mysql">
  3. <Resources>
  4. <Resource-root Path=Mysql-connector-java-5.1.17-bin.jar"/>
  5. </Resources>
  6. <Dependencies>
  7. <Module Name="Javax. api"/>
  8. </Dependencies>
  9. </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:

  1. <Drivers>
  2. <Driver Name="Com. mysql" Module="Com. mysql">
  3. <Xa-datasource-class>Com. mysql. jdbc. jdbc2.optional. MysqlXADataSource</Xa-datasource-class>
  4. </Driver> 
  5. </Drivers> 

4. Configure the data source

Method 1: directly edit the standalone. xml file

Add the following content to the datasources block: 2-15

  1. <Datasources>
  2. <Datasource Jndi-name="Java: jboss/datasources/MysqlDS" Pool-name="MysqlDS">
  3. <Connection-url>Jdbc: mysql: // localhost: 3306/msqlDB</Connection-url>
  4. <Driver>Com. mysql</Driver>
  5. <Transaction-isolation>TRANSACTION_READ_COMMITTED</Transaction-isolation>
  6. <Pool>
  7. <Min-pool-size>10</Min-pool-size>
  8. <Max-pool-size>100</Max-pool-size>
  9. <Prefill>True</Prefill>
  10. </Pool>
  11. <Security>
  12. <User-name>User Name</User-name>
  13. <Password>Password</Password>
  14. </Security>
  15. </Datasource>
  16. </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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.