解决方法:
修改Druid
配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| 在spring-dao.xml文件中修改
<bean abstract="true" id="parentDatasource" class="com.alibaba.druid.pool.DruidDataSource" >
<property name="maxActive" value="1000" /> <property name="initialSize" value="10" /> <property name="maxWait" value="60000" /> <property name="minIdle" value="10" /> <property name="timeBetweenEvictionRunsMillis" value="60000" />
<property name="minEvictableIdleTimeMillis" value="60000" /> <property name="validationQuery" value="SELECT 1 " /> <property name="testWhileIdle" value="true" /> <property name="testOnBorrow" value="false" /> <property name="testOnReturn" value="false" /> <property name="removeAbandoned" value="true" /> <property name="removeAbandonedTimeout" value="1800" /> <property name="logAbandoned" value="true" /> <property name="proxyFilters"> <list> <ref bean="stat-filter"/> <ref bean="wall-filter"/> </list> </property>
<property name="filters" value="stat,log4j,wall" />
</bean> <bean id="stat-filter" class="com.alibaba.druid.filter.stat.StatFilter"> <property name="slowSqlMillis" value="30000"/> <property name="logSlowSql" value="true"/> <property name="mergeSql" value="true"/> </bean>
<bean id="wall-filter" class="com.alibaba.druid.wall.WallFilter"> <property name="dbType" value="sqlserver"/> <property name="config" ref="wall-config"/> </bean>
<bean id="wall-config" class="com.alibaba.druid.wall.WallConfig"> <property name="multiStatementAllow" value="true"/> </bean>
|
如果jdbc是mysql需要在jdbcurl中加
allowmultiqueries=true
例:
url="jdbc:mysql://localhost:3306/fivecrowdsourcing?allowMultiQueries=true"
详情:
https://blog.csdn.net/qq_36345950/article/details/83628775