if dabase is down during the first connect no reconnect attempt is done whenspring.jpa.database-platform=org.hibernate.dialect.OracleDialect is missing in application properties.
The issue can be reproduced when a database docker container is used ( ... from postgres for example) At the first start the database is created and this take some time, so that the database is not ready when a (web)application connects to this database before it is online.
The property spring.jpa.database-platform=org.hibernate.dialect.OracleDialect fix it, but this property is deprecated:
2024-02-02T18:23:31.866Z WARN 33 --- [ main] org.hibernate.orm.deprecation : HHH90000025: PostgreSQLDialect
does not need to be specified explicitly using hibernate.dialect (remove the property setting and it will be selected by default)
I've deployed the application and database in the same docker container. Starting the application when I remove the database folder on the host, it runs into this error.
without the property spring.jpa.database-platform=org.hibernate.dialect.OracleDialect
384768a2b940 iot2 "/bin/sh -c '(docker…" 14 seconds ago Up 8 seconds (health: starting) 0.0.0.0:5432->5432/tcp, 0.0.0.0:8080->8080/tcp iot2
d6c2a350d12a iot2 "/bin/sh -c '(docker…" About a minute ago Up About a minute (unhealthy) 0.0.0.0:5432->5432/tcp, 0.0.0.0:8080->8080/tcp iot2
with the property spring.jpa.database-platform=org.hibernate.dialect.OracleDialect
91c613d0e06a iot2 "/bin/sh -c '(docker…" 7 seconds ago Up 5 seconds (health: starting) 0.0.0.0:5432->5432/tcp, 0.0.0.0:8080->8080/tcp iot2
72f6fb81be2f iot2 "/bin/sh -c '(docker…" About a minute ago Up About a minute (healthy) 0.0.0.0:5432->5432/tcp, 0.0.0.0:8080->8080/tcp iot2
Comment From: wilkinsona
Duplicates https://github.com/spring-projects/spring-boot/issues/4779.
Configuring Hibernate so that it does not have to connect to the database during startup is the correct thing to do.