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

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

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

    隨筆 - 59  文章 - 70  trackbacks - 0
    <2008年7月>
    293012345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789

    常用鏈接

    留言簿(5)

    隨筆分類

    隨筆檔案

    搜索

    •  

    積分與排名

    • 積分 - 174150
    • 排名 - 340

    最新評論

    閱讀排行榜

    評論排行榜

    第一天來公司上班的時候,竟然被配置WEB程序的問題搞了半天。郁悶至極。
    上班也有一年了,連個基礎(chǔ)的東西都搞不定,難怪被本人鄙視
    在tomcat的/conf/server.xml中配置連接池。
    插入以下代碼
    <ResourceParams name="jdbc/MySQLDB">
    <parameter>
    <name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>

    <!-- Don't set this any higher than max_connections on your
    MySQL server, usually this should be a 10 or a few 10's
    of connections, not hundreds or thousands -->

    <parameter>
    <name>maxActive</name>
    <value>30</value>
    </parameter>

    <!-- You don't want to many idle connections hanging around
    if you can avoid it, only enough to soak up a spike in
    the load -->

    <parameter>
    <name>maxIdle</name>
    <value>4</value>
    </parameter>

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

    <!-- Don't use autoReconnect=true, it's going away eventually
    and it's a crutch for older connection pools that couldn't
    test connections. You need to decide if your application is
    supposed to deal with SQLExceptions (hint, it should), and
    how much of a performance penalty you're willing to pay
    to ensure 'freshness' of the connection -->

    <parameter>
    <name>validationQuery</name>
    <value>SELECT 1</value>
    </parameter>

    <!-- The most conservative approach is to test connections
    before they're given to your application. For most applications
    this is okay, the query used above is very small and takes
    no real server resources to process, other than the time used
    to traverse the network.

    If you have a high-load application you'll need to rely on
    something else. -->

    <parameter>
    <name>testOnBorrow</name>
    <value>true</value>
    </parameter>

    <!-- Otherwise, or in addition to testOnBorrow, you can test
    while connections are sitting idle -->

    <parameter>
    <name>testWhileIdle</name>
    <value>true</value>
    </parameter>

    <!-- You have to set this value, otherwise even though
    you've asked connections to be tested while idle,
    the idle evicter thread will never run -->

    <parameter>
    <name>timeBetweenEvictionRunsMillis</name>
    <value>10000</value>
    </parameter>

    <!-- Don't allow connections to hang out idle too long,
    never longer than what wait_timeout is set to on the
    server...A few minutes or even fraction of a minute
    is sometimes okay here, it depends on your application
    and how much spikey load it will see -->

    <parameter>
    <name>minEvictableIdleTimeMillis</name>
    <value>20000</value>
    </parameter>

    <!-- Username and password used when connecting to MySQL -->

    <parameter>
    <name>username</name>
    <value>root</value>
    </parameter>

    <parameter>
    <name>password</name>
    <value>sa</value>
    </parameter>

    <!-- Class name for the Connector/J driver -->

    <parameter>
    <name>driverClassName</name>
    <value>com.mysql.jdbc.Driver</value>
    </parameter>

    <!-- The JDBC connection url for connecting to MySQL, notice
    that if you want to pass any other MySQL-specific parameters
    you should pass them here in the URL, setting them using the
    parameter tags above will have no effect, you will also
    need to use & to separate parameter values as the
    ampersand is a reserved character in XML -->

    <parameter>
    <name>url</name>
    <value>jdbc:mysql://localhost:3306/xinhui</value>
    </parameter>

    </ResourceParams>
    竟然報錯!調(diào)了半天還是沒出來,主管老是跑過來問,你的配好沒有?
    只能不好意思的答復(fù)到:還沒有
    最后將以上的代碼改為
    <Resource name="jdbc/MySQLDB" auth="Container" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" maxIdle="20" maxWait="5000" username="root" password="123456" url="jdbc:mysql://localhost:3306/xinhui" maxActive="100" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true"/>這下竟然成功了。在網(wǎng)上查了下相關(guān)的問題,沒有很好的解答。
    應(yīng)該是tomcat版本的問題吧
    posted on 2008-07-25 09:04 JasonChou 閱讀(175) 評論(0)  編輯  收藏 所屬分類: server&os

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 亚洲va成无码人在线观看| 亚洲精品中文字幕乱码三区| 成人免费在线看片| av大片在线无码免费| 久久精品国产亚洲AV无码偷窥 | 免费毛片在线视频| 免费人成年轻人电影| 亚洲免费人成在线视频观看| 亚洲理论片中文字幕电影| 亚洲AV无码成人精品区狼人影院 | 野花高清在线观看免费完整版中文 | 国产免费AV片在线播放唯爱网| 亚洲综合综合在线| 免费在线视频你懂的| 亚洲精品亚洲人成在线观看下载| 午夜亚洲AV日韩AV无码大全| 色天使亚洲综合在线观看| 久久久精品国产亚洲成人满18免费网站 | 在线美女免费观看网站h| 全部免费a级毛片| EEUSS影院WWW在线观看免费| 永久免费的网站在线观看| 亚洲成a人片在线不卡一二三区| 国产午夜成人免费看片无遮挡| 性xxxxx免费视频播放 | 国产区卡一卡二卡三乱码免费| 亚洲人成在线观看| 成人免费网站视频www| 67194成手机免费观看| 最新精品亚洲成a人在线观看| 亚洲欧美aⅴ在线资源| 免费H网站在线观看的| 亚洲AV无码一区二区三区电影| 久久激情亚洲精品无码?V| 精品久久久久久亚洲中文字幕| 100000免费啪啪18免进| 国产亚洲综合视频| 99视频在线精品免费观看6| 亚洲欧洲日韩国产综合在线二区| 九九精品免费视频| 亚欧乱色国产精品免费视频|