javaspringpostgresqlspring-data-jpahikaricp

How to set the ReadTimeout for JPA connections


How can i set the read timeout (socket#sotimeout) on a jpa connection. Do i have to set javax.persistence.query.timeout or is it spring.datasource.socketTimeout? Any hint how i could test that the value is really set?

I'm using jdbc-postgresql with spring-jpa and hikaricp.


Solution

  • The socket#sotimeout can be set by yaml properties. It has to be look like this:

    spring:
      datasource:
        hikari:
          data-source-properties:
            socketTimeout: 20 #default 0s