默认连接池不工作

Default connection pool not working

我在 Whosebug 上看到了一些类似的问题,none 其中有帮助。那我走了。

我正在使用以下库

tomcat.jdbc.pool.DatasourceProxy::createPool() method 中检查 poolProperties 我得到以下内容

ConnectionPool[defaultAutoCommit=null; defaultReadOnly=null; defaultTransactionIsolation=-1; defaultCatalog=null; driverClassName=com.mysql.jdbc.Driver; maxActive=100; maxIdle=100; minIdle=10; initialSize=10; maxWait=30000; testOnBorrow=false; testOnReturn=false; timeBetweenEvictionRunsMillis=5000; numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=60000; testWhileIdle=false; testOnConnect=false; password=********; url=jdbc:mysql://localhost/test; username=test; validationQuery=null; validationQueryTimeout=-1; validatorClassName=null; validationInterval=30000; accessToUnderlyingConnectionAllowed=true; removeAbandoned=false; removeAbandonedTimeout=60; logAbandoned=false; connectionProperties=null; initSQL=null; jdbcInterceptors=null; jmxEnabled=true; fairQueue=true; useEquals=true; abandonWhenPercentageFull=0; maxAge=0; useLock=false; dataSource=null; dataSourceJNDI=null; suspectTimeout=0; alternateUsernameAllowed=false; commitOnReturn=false; rollbackOnReturn=false; useDisposableConnectionFacade=true; logValidationErrors=false; propagateInterruptState=false; ignoreExceptionOnPreLoad=false; 

然而,我每天早上都收到 java.net.SocketException: Broken pipe。我的配置有什么问题吗?我没有创建数据源。根据 documentation 一切都应该自动配置。

更新:我得到的异常与this问题完全相似。在那个问题中,建议使用池化机制。我正在使用数据源池,但我仍然遇到问题

它可能无法解决您的特定问题(很难确定您提供的信息),但我建议配置适合 MySQL 的验证查询并启用 testOnBorrow 或类似的。