---
title: "Jboss&MySql配置"
author: "wonka438"
date: "2011-03-21T22:11:04Z"
tags: []
categories: ["企业架构"]
slug: "jboss-mysql"
draft: false
lastmod: "2011-03-21T22:11:04Z"
id: 969961
url: "https://wonka438.iteye.com/blog/969961"
---

&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;!-- $Id: mysql-ds.xml 41017 2006-02-07 14:26:14Z acoliver $ --&gt;  
&lt;!--  Datasource config for MySQL using 3.0.9 available from:  
http://www.mysql.com/downloads/api-jdbc-stable.html  
\--&gt;

&lt;datasources&gt;  
  &lt;local-tx-datasource&gt;  
    &lt;jndi-name&gt;MySqlDS&lt;/jndi-name&gt;  
    &lt;connection-url&gt;jdbc:mysql://localhost:**3306** /cst&lt;!--这个数据库必须在本地存在！！--&gt; &lt;/connection-url&gt;  
    &lt;connection-property name="characterEncoding"&gt;utf8&lt;/connection-property&gt;  
    &lt;driver-class&gt;com.mysql.jdbc.Driver&lt;/driver-class&gt;  
    &lt;user-name&gt;root &lt;/user-name&gt;  
    &lt;password&gt;quan &lt;/password&gt;  
    &lt;exception-sorter-class-name&gt;org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter&lt;/exception-sorter-class-name&gt;  
    &lt;!-- should only be used on drivers after 3.22.1 with "ping" support  
    &lt;valid-connection-checker-class-name&gt;org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker&lt;/valid-connection-checker-class-name&gt;  
    --&gt;  
    &lt;!-- sql to call when connection is created  
    &lt;new-connection-sql&gt;some arbitrary sql&lt;/new-connection-sql&gt;  
      --&gt;  
    &lt;!-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers  
    &lt;check-valid-connection-sql&gt;some arbitrary sql&lt;/check-valid-connection-sql&gt;  
      --&gt;

    &lt;!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) --&gt;  
    &lt;metadata&gt;  
       &lt;type-mapping&gt;mySQL&lt;/type-mapping&gt;  
    &lt;/metadata&gt;  
  &lt;/local-tx-datasource&gt;  
&lt;/datasources&gt;