配置資料來源檔案mysql-ds.xml, 放入目錄${jboss_home}/server/default/deploy中,這裡順便記錄一下mysql-ds.xml的格式,如下:
<?xml version="1.0" encoding="UTF-8"?></p><p><!-- $Id: mysql-ds.xml 41017 2006-02-07 14:26:14Z acoliver $ --><br /><!-- Datasource config for MySQL using 3.0.9 available from:</p><p>http://www.mysql.com/downloads/api-jdbc-stable.html</p><p>--></p><p><datasources><br /> <local-tx-datasource><br /> <jndi-name>MySqlDS</jndi-name><br /> <connection-url>jdbc:mysql://localhost:3306/ejb</connection-url><br /> <driver-class>com.mysql.jdbc.Driver</driver-class><br /> <user-name>root</user-name><br /> <password>root</password><br /> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name><br /> <!-- should only be used on drivers after 3.22.1 with "ping" support<br /> <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name><br /> --><br /> <!-- sql to call when connection is created<br /> <new-connection-sql>some arbitrary sql</new-connection-sql><br /> --><br /> <!-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers<br /> <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql><br /> --></p><p> <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) --><br /> <metadata><br /> <type-mapping>mySQL</type-mapping><br /> </metadata><br /> </local-tx-datasource><br /></datasources><br />然後將用於串連mysql的mysql-connector-java-5.1.5-bin.jar放入${jboss_home}/server/default/lib目錄下。在該目錄下我也發現了另外一個用於串連oracle的jar包ojdbc6.jar。
下面提供這幾個jar包的:http://dl.dbank.com/c03zxdzd90