Search code examples
timeoutliquibaseconnection-timeout

How can I set the Liquibase database connection timeout and retry count?


  1. How can I set the time that Liquibase waits to establish a connection to a database server (specifically, PostgreSQL) before failing (i.e. the connection timeout)?

  2. How can I set the number of times that Liquibase will attempt to connect to a database server before aborting (i.e. the connection retry count)?


Solution

  • Liquibase uses a jdbc connection. According to this answer network timeout was only introduced to JDBC from spec 4.1 on.

    According to postgres jdbc doc there is a property like loginTimeout that should handle this.

    Liquibase will hand over jdbc driver properties to the connection by specifying the command-line param driverPropertiesFile.

    Haven't tried it myself but it looks good enough to give it a try...