如何在Jboss中配置資料來源

來源:互聯網
上載者:User

資料來源配置:在jboss/doc/examples/jca,如果你的是mysql資料庫,則選mysql-ds.xml

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

<datasources>

  <local-tx-datasource>

    <jndi-name>DefaultMySqlDS</jndi-name>

    <connection-url>jdbc:mysql://localhost:3306/itcast?useUnicode=true&amp;characterEncoding=UTF-8</connection-url>

   <driver-class>org.gjt.mm.mysql.Driver</driver-class>

   <user-name>root</user-name>

   <password>123456</password>

   <min-pool-size>3</min-pool-size>

   <max-pool-size>100</max-pool-size>

  <!--

     TRANSACTION_READ_UNCOMMITTED

     TRANSACTION_READ_COMMITTED

     TRANSACTION_REPEATABLE_READ

     TRANSACTION_SERIALIZABLE

   

   <transaction-isolation>TRANSACTION_SERIALIZABLE</transaction-isolation>-->

  <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>


資料來源的起名必須遵守規定,如mysql-ds.xml,即所有資料來源的尾碼名都必須是ds.xml結尾的.

把資料庫驅動包拷貝到配置項的lib目錄下.如default/lib
然後把資料來源的設定檔放到deploy目錄下面.重啟jobss即可.
然後可以進到jboss的管理頁面進行管理.注意在這裡變更的話,是只有這一次運行期間才是有效,如果關閉了則失效了,如果要永久性的生效的話,那麼只能在ds.xml設定檔中變更。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.