JBoss配置mysql数据源

类别:Java 点击:0 评论:0 推荐:

编写mysql-ds.xml并放在server/default/deploy(如果使用default作为server的话)

<?xml version="1.0" encoding="UTF-8"?>

<!-- $Id: mysql-ds.xml,v 1.3 2004/09/15 14:37:40 loubyansky Exp $ -->
<!--  Datasource config for MySQL using 3.0.9 available from:
http://www.mysql.com/downloads/api-jdbc-stable.html
-->

<datasources>
  <local-tx-datasource>
    <jndi-name>MySqlDSForum</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/dbname</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>xxx</user-name>
    <password>xxx</password>
    <min-pool-size>5</min-pool-size>
    <max-pool-size>30</max-pool-size>
    <idle-timeout-minutes>0</idle-timeout-minutes>

      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
      <metadata>
         <type-mapping>mySQL</type-mapping>
      </metadata>
  </local-tx-datasource>

</datasources>

同时确保mysql的驱动在classpath上或者在server/lib下

本文地址:http://com.8s8s.com/it/it11518.htm