配置Tomcat JNDI数据源
2017-04-25 00:00
381 查看
1、在tomcat容器中conf/context.xml中配置
2、在spring的applicationContext.xml中配置(在spring中集成)
<?xml version='1.0' encoding='utf-8'?> <!-- The contents of this file will be loaded for each web application --> <Context> <!-- Default set of monitored resources --> <WatchedResource>WEB-INF/web.xml</WatchedResource> <!-- Uncomment this to disable session persistence across Tomcat restarts --> <!-- <Manager pathname="" /> --> <!-- Uncomment this to enable Comet connection tacking (provides events on session expiration as well as webapp lifecycle) --> <!-- <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" /> --> <!-- <Resource driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@127.0.0.1:1521:ORCL" auth="Container" maxActive="20" maxIdle="10" maxWait="10000" name="jndi/test1" type="javax.sql.DataSource" password="test" username="test" /> --> <!-- 使用阿里巴巴的DruidDataSource配置针对Oracle数据库的JNDI数据源 --> <Resource name="jndi/test2" factory="com.alibaba.druid.pool.DruidDataSourceFactory" auth="Container" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8" password="test" username="test" initialSize="20" minIdle="2" maxActive="50" maxWait="10000" timeBetweenEvictionRunsMillis="60000" minEvictableIdleTimeMillis="300000" poolPreparedStatements="false" maxPoolPreparedStatementPerConnectionSize="20" removeabandoned="true" removeabandonedtimeout="60" logabandoned="false" filters="stat"/> </Context>
2、在spring的applicationContext.xml中配置(在spring中集成)
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName"> <value>java:comp/env/jndi/test2</value> </property> </bean>
相关文章推荐
- tomcat JNDI数据源配置
- 在tomcat中配置Postgres + PostGIS JNDI数据源导致PGgeometry无法正常处理的问题
- tomcat JNDI数据源配置
- Tomcat6.0 配置JNDI数据源总结
- JNDI SRPING TOMCAT 配置数据源
- tomcat中通过JNDI数据源配置使用--时间沙漏
- tomcat中通过JNDI数据源配置使用
- JNDI:如何在TOMCAT中配置数据源通过JNDI访问测试操作步骤
- Tomcat 配置JNDI 数据源
- tomcat中通过JNDI数据源配置使用
- Tomcat5.5 私有JNDI、数据源(链接池)的配置
- Tomcat配置JNDI数据源-配置server.xml
- Tomcat6.0+mysql5.0+JNDI数据源配置方法
- Tomcat 6.0配置数据源(DBCP)和JNDI使用
- tomcat数据源配置及JNDI使用
- Tomcat5.5数据源的配置(JNDI)
- Tomcat5.5私有JNDI、数据源(链接池)的配置
- WEB项目中,让FineReport6.5使用Tomcat下所配置的JNDI数据源
- Tomcat5.0.28下的jndi数据源配置
- tomcat配置数据源通过JNDI访问mysql数据库