2
  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)?

Derek Mahar
  • 27,608
  • 43
  • 124
  • 174

1 Answers1

3

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...

Community
  • 1
  • 1
Jens
  • 6,243
  • 1
  • 49
  • 79
  • Oh, as for the retries: I don't see anything in liquibase that would do this. Could be done by a datasource but that seems to be available only in Spring Liquibase or in a CDI context. So maybe there is no way to do this in liquibase...(maybe create a feature ticket in liquibase jira to add this in the future?) – Jens Sep 16 '16 at 15:47
  • Spring Liquibase? – Derek Mahar Sep 16 '16 at 16:10
  • 1
    I found http://www.liquibase.org/javadoc/liquibase/integration/spring/SpringLiquibase.html. Is this part of the Spring Integration project? – Derek Mahar Sep 16 '16 at 16:11
  • Yep. https://github.com/liquibase/liquibase/blob/master/liquibase-core/src/main/java/liquibase/integration/spring/SpringLiquibase.java – Jens Sep 16 '16 at 16:37