添加Server數(shù)據(jù)源配置
AS7啟動(dòng)分為兩種形式,一種是domain形式的,一種是standalone,這里我們選擇standalone。 打開JBOSS_HOME\standalone\configuration\standalone.xml文件,在<datasources>下添加如下內(nèi)容:
<datasource jndi-name="java:jboss/datasources/MySqlDS" pool-name="MySqlDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>
jdbc:mysql://192.168.1.150:3306/hospital?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8
</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>
<use-strict-min>
false
</use-strict-min>
<flush-strategy>
FailingConnectionOnly
</flush-strategy>
</pool>
<security>
<user-name>
runes
</user-name>
<password>
runes
</password>
</security>
<statement>
<prepared-statement-cache-size>
32
</prepared-statement-cache-size>
</statement>
</datasource>
然后在<drivers>下添加如下內(nèi)容:
<driver name="com.mysql" module="com.mysql">
<xa-datasource-class>
com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
</xa-datasource-class>
</driver>
OK,這樣就完成了MySQL數(shù)據(jù)源的配置,現(xiàn)在用standalone的形式啟動(dòng)AS7,會(huì)看到輸入中有MySQL數(shù)據(jù)源的的內(nèi)容,如下圖: