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&characterEncoding=UTF8&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>
其余的不变