JNDI配置笔记

先在tomcat Context.xml配置文件中配置

<Resource name="jdbc/elifecrm"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://192.168.13.11:13306/crm_elife?useUnicode=true&amp;characterEncoding=UTF8&amp;zeroDateTimeBehavior=convertToNull"
username="crm_elife"
password="elife123"
initialSize="10"
maxActive="500"
minIdle="10"
maxIdle="500"
maxWait="500"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
validationQuery="SELECT 1 from dual"
validationInterval="30000"
timeBetweenEvictionRunsMillis="30000"
removeAbandonedTimeout="60"
removeAbandoned="false"
logAbandoned="true"
minEvictableIdleTimeMillis="30000"/>

 

在项目配置数据库连接的xml中配置

 

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

其余的不变

posted @ 2015-09-29 14:54  萧雪痕  阅读(510)  评论(0编辑  收藏  举报