1、把所用数据库的驱动放到/jboss/sever/default /lib/下
比如mysql的jdbc驱动:mysql-connectiong-5.08.jar
2、把/jboss/doc/examples/jca/***-ds.xml复制到/jboss/server/default/deploy/下面
<datasources>
<local-tx-datasource>
<jndi-name>DefaultMySqlDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/foshanshop?useUnicode=true&characterEncoding=utf8
</connection-url>
<driver-class>org.gjt.mm.mysql.Driver</driver-class>
<user-name>root</user-name>
<password>123456</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
</exception-sorter-class-name>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
sql server的数据源配置
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>MSSQLDS</jndi-name>
<connection-url>jdbc:microsoft:sqlserver:// localhost:1433;DatabaseName=foshanshop </connection-url>
<driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
<user-name>sa</user-name>
<password>123456</password>
<metadata>
<type-mapping>MS SQLSERVER2000</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>