Skip to content

MySQL connection 8 hours timeout issue #43

@lz000

Description

@lz000

MySQL close idle connections after 8 hours. I have 2 questions regarding this.

  1. With the nonBlocking pool, if I specify healthCheck and idleTimeBeforeHealthCheck, does it mean it will keep the connections alive? for example
Pools.nonBlocking()
                        .connectionProvider(ConnectionProvider.from(url, username, password))
                        .healthCheck(DatabaseType.MYSQL)
                        .idleTimeBeforeHealthCheck(5, TimeUnit.SECONDS)
                        .build();
  1. If I use the blocking pool and pass spring boot auto configured dataSource, will it keep the connection alive? for example:
@Configuration
public class DataSourceConfig {

    @Bean
    public Database db(DataSource ds){
        return Database.fromBlocking(ds);
    }
}

in application.properties

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://...
spring.datasource.username=username
spring.datasource.password=password

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions