<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Jeffrey's Sky

    Go with wind
    隨筆 - 14, 文章 - 1, 評論 - 15, 引用 - 0
    數據加載中……

    開源軟件問題記錄系列 之一 在 Tomcat 中設置 Datasource

    Tomcat提供了靈活且簡單的JNDI及Datasource設置方式。

    這里,記錄我在學習應用過程中的問題。

    1. 首先要在你的自己的應用程序中WEB-INF/web.xml 中添加一個Resource-ref, 指定Datasource 的 JNDI。
        <resource-ref>
          <description>DB Connection</description>
          <res-ref-name>jdbc/storedb</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <res-auth>Container</res-auth>
      </resource-ref>
    2. 在Tomcat的 config/context.xml中添加Resource。 (本例中使用的是MySql作為 DB)

       <!-- maxActive: Maximum number of dB connections in pool. Make sure you
             configure your mysqld max_connections large enough to handle
             all of your db connections. Set to -1 for no limit.
             -->

        <!-- maxIdle: Maximum number of idle dB connections to retain in pool.
             Set to -1 for no limit.  See also the DBCP documentation on this
             and the minEvictableIdleTimeMillis configuration parameter.
             -->

        <!-- maxWait: Maximum time to wait for a dB connection to become available
             in ms, in this example 10 seconds. An Exception is thrown if
             this timeout is exceeded.  Set to -1 to wait indefinitely.
             -->

        <!-- username and password: MySQL dB username and password for dB connections  -->

        <!-- driverClassName: Class name for the old mm.mysql JDBC driver is
             org.gjt.mm.mysql.Driver - we recommend using Connector/J though.
             Class name for the official MySQL Connector/J driver is com.mysql.jdbc.Driver.
             -->
       
        <!-- url: The JDBC connection url for connecting to your MySQL dB.
             -->

      <Resource name="jdbc/storedb" auth="Container" type="javax.sql.DataSource"
                   maxActive="100" maxIdle="30" maxWait="10000"
                   username="root" password="passw0rd" driverClassName="com.mysql.jdbc.Driver"
                   url="jdbc:mysql://localhost:3306/storedb"/>


    posted on 2010-08-02 10:51 Jeffrey Feng 閱讀(228) 評論(0)  編輯  收藏 所屬分類: 開源技術

    主站蜘蛛池模板: 337P日本欧洲亚洲大胆艺术图| 久章草在线精品视频免费观看| 最近免费最新高清中文字幕韩国 | 亚洲一区二区三区精品视频| 亚洲免费视频网站| 久久亚洲精品成人| 亚洲午夜精品久久久久久浪潮| 亚洲色无码专区一区| 国产免费久久精品99re丫y| www国产亚洲精品久久久日本| 亚洲精品国产综合久久久久紧 | 亚洲免费在线视频| 久久久亚洲欧洲日产国码二区| 最近免费最新高清中文字幕韩国| 亚洲精品国产成人中文| 四虎国产精品成人免费久久| 亚洲一级片内射网站在线观看| av午夜福利一片免费看久久| 两性刺激生活片免费视频| 亚洲人成电影在线观看网| 免费一本色道久久一区| 亚洲国产欧美国产综合一区| 亚洲AV无码不卡在线观看下载| 成人毛片100免费观看| 亚洲人成影院在线| a级毛片无码免费真人| 欧洲精品码一区二区三区免费看| 亚洲中文字幕无码永久在线| 免费A级毛片无码专区| 一区二区亚洲精品精华液| 免费乱理伦在线播放| AAA日本高清在线播放免费观看| 亚洲视频日韩视频| 国产美女无遮挡免费网站| 美女网站在线观看视频免费的| 国产精品免费一级在线观看| 一级毛片免费观看不收费| 亚洲成人免费在线| 永久久久免费浮力影院| 亚洲卡一卡2卡三卡4麻豆| 国产免费黄色大片|