Linux - tomcat -jndi数据源配置

时间:2023-05-18 22:40:56

Linux - tomcat -jndi数据源配置

tomcat/conf/context .xml 文件中修改如下

 <Resource
name="/jdbc/……"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
jmxEnabled="true"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="false"
validationQuery="SELECT 1"
validationInterval="30000"
timeBetweenEvictionRunsMillis="30000"
maxActive="800"
minIdle="50"
maxIdle="100"
maxWait="10000"
minEvictableIdleTimeMillis="30000"
initialSize="10"
removeAbandonedTimeout="3600"
removeAbandoned="true"
logAbandoned="true"
2 jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://……/……?allowMultiQueries=true"
username="……"
password="……"
/>