久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

JNDI+Tomcat配置數(shù)據(jù)源的兩種方式

 藏經(jīng)閣_蒼穹 2015-11-21

全局jndi配置 :此種配置需要在server.xml中配置數(shù)據(jù)源,。 

0、需要在tomcat下加入數(shù)據(jù)庫(kù)連接的jar包

1,、web.xml配置

<resource-ref>
    <description>my DB Connection</description>
    <res-ref-name>mydataSource </res-ref-name>   must be same as server.xml
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>

2、applicationContext.xml下配置

<bean id="dataSource"
    class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="java:comp/env/mydataSource " />
</bean>

3、server.xml中配置為

<!-- Global JNDI resources -->
 <GlobalNamingResources>
   <!-- Test entry for demonstration purposes -->
   <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
   <!-- Editable user database that can also be used by
        UserDatabaseRealm to authenticate users -->
   <Resource name="UserDatabase" auth="Container"
             type="org.apache.catalina.UserDatabase"
      description="User database that can be updated and saved"
          factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
         pathname="conf/tomcat-users.xml" />
   <Resource name="mydataSource" auth="Container" type="javax.sql.DataSource"
                               url="jdbc:oracle:thin:@192.168.2.104:1521:ora10g"
                           driverClassName="oracle.jdbc.driver.OracleDriver"
                           password="aa"
                           username="aa"
                           initialSize="5"
                           maxActive="10"
                           maxIdle="5"
                           minIdle="2"
                           maxWait="10000"
                           removeAbandoned="true"
                           logAbandoned="true"
                           removeAbandonedTimeout="60"
                           timeBetweenEvictionRunsMillis="900000"
                           minEvictableIdleTimeMillis="1800000"
                           numTestsPerEvictionRun="100"
                           validationQuery="select count(0) from dual"
                           poolPreparedStatements="true"
                           maxOpenPreparedStatements="100"/>
 </GlobalNamingResources>

4,、tomcat/conf下localhost下的配置如下

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="F:/workspace/cuapp/WebRoot" path="xj-adminportal" reloadable="false">
    <ResourceLink name="mydataSource " global="mydataSource " type="javax.sql.DataSource"/>
</Context>
非全局jndi配置步驟 :此種配置方式不需要在server.xml中配置數(shù)據(jù)源,,而只在tomcat/conf/Catalina/localhost下的啟動(dòng)配置中配置即可,。注意紅色字體名稱必須和相同,。

0,、需要在tomcat/common/lib下加入數(shù)據(jù)庫(kù)連接的jar包

1,、web.xml配置

<resource-ref>
     <description>my DB Connection</description>
     <res-ref-name>mydataSource </res-ref-name>  
     <res-type>javax.sql.DataSource</res-type>
     <res-auth>Container</res-auth>
 </resource-ref>

2,、applicationContext.xml下配置

<bean id="dataSource"
    class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="java:comp/env/mydataSource " />
</bean>

3,、在tomcat的conf下的localhost下的配置如下

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="F:/workspace/cuapp/WebRoot" path="cuapp" reloadable="false">
<Resource name="mydataSource" auth="Container" type="javax.sql.DataSource"
                   url="jdbc:oracle:thin:@192.168.2.104:1521:ora10g"
                driverClassName="oracle.jdbc.driver.OracleDriver"
                password="aa"
                username="aa"
                initialSize="2"
                maxActive="3"
                maxIdle="1"
                minIdle="1"
                maxWait="10000"
                removeAbandoned="true"
                logAbandoned="true"
                removeAbandonedTimeout="60"
                timeBetweenEvictionRunsMillis="900000"
                minEvictableIdleTimeMillis="1800000"
                numTestsPerEvictionRun="100"
                validationQuery="select count(0) from dual"
                poolPreparedStatements="true"
                maxOpenPreparedStatements="100"/>
</Context>

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn),。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多