Tomcat7配置发布jndi数据源
Tomcat7配置发布jndi数据源
Jul-13-2010
在D:\apache-tomcat-7.0.0\conf\context.xml中新增
<Resource name="jdbc/xxx" auth="Container" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" validationQuery="SELECT 1" loginTimeout="10" maxWait="5000" username="root" password="root" testOnBorrow="true" url="jdbc:mysql://localhost:3306/xxx?user=root&password=root&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8" />
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName"><value>java:comp/env/jdbc/xxx</value></property> </bean>