Jboss AS7 MySQL数据源(DataSource)创建

1. 创建驱动程序Module

参见 http://mlw2000.iteye.com/blog/1270621

 

2. 注册数据源驱动程序

修改$JBOSS_HOME/standalone/configuration/standalone.xml文件,查找datasources节点下drivers节点,在drivers节点下添加

<driver name="mysql" module="com.mysql">
    <driver-class>com.mysql.jdbc.Driver</driver-class>
</driver>
 

3. 注册数据源

修改$JBOSS_HOME/standalone/configuration/standalone.xml文件,查找datasources节点,并添加datasource节点

<datasource jndi-name="java:/McmsDS" pool-name="McmsDS_Pool" enabled="true" jta="true" use-java-context="true" use-ccm="true">
    <connection-url>jdbc:mysql://localhost/mcms?useUnicode=true&amp;characterEncoding=utf-8</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <driver>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>
        <use-strict-min>false</use-strict-min>
    </pool>
    <security>
        <user-name>root</user-name>
        <password>123</password>
    </security>
    <validation>
        <validate-on-match>false</validate-on-match>
        <background-validation>false</background-validation>
        <useFastFail>false</useFastFail>
    </validation>
    <statement>
        <prepared-statement-cache-size>100</prepared-statement-cache-size>
        <share-prepared-statements/>
    </statement>
</datasource>
 

你可能感兴趣的:(Jboss AS7 MySQL数据源(DataSource)创建)