Grails Gorm超时:池空。无法获取连接

时间:2016-09-06 07:01:18

标签: hibernate grails gorm

  

超时:池空。无法在10秒内获取连接,无法使用[size:7;忙:0;空闲:0; lastwait:10000]

上述错误是在我的应用程序运行很长时间后出现的。

以下是我的GORM数据库配置:

propertyShortSlave:
    pooled: true
    jmxExport: true
    driverClassName: com.mysql.jdbc.Driver
    url: url
    username: uuuuuu
    password: pppppp
    dbCreate: validate
    readOnly: true
    dialect: org.hibernate.dialect.MySQL5InnoDBDialect
    properties:
            initialSize: 5
            maxActive: 7
            minIdle: 5
            validationQuery: SELECT 1
            maxIdle: 7
            maxWait: 10000
            maxAge: 600000
            timeBetweenEvictionRunsMillis: 5000
            minEvictableIdleTimeMillis: 60000
            validationQueryTimeout: 3
            validationInterval: 15000
            testOnBorrow: true
            testWhileIdle: true
            testOnReturn: false
            jdbcInterceptors: "ConnectionState;StatementCache(max=200)"

我该如何解决?

1 个答案:

答案 0 :(得分:0)

尝试使用这些:

dataSource {
....
 url = "jdbc:mysql://localhost:3306/databaseName?autoReconnect=true&useUnicode=true&CharSet=UTF-8&characterEncoding=UTF-8"
....
properties {
 ....
 validationQuery = "SELECT 1"
 ....
 }
}