skip to Main Content

Facing below error while running app from the cloud however this error is not getting when running from the local.

Caused by: java.sql.SQLTransientConnectionException: HikariPool-2 - Connection is not available, request timed out after 30000ms.
    at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:695)
    at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:197)
    at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:162)
    at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:128)
    at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
    at org.hibernate.internal.NonContextualJdbcConnectionAccess.obtainConnection(NonContextualJdbcConnectionAccess.java:38)
    at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:108)
    ... 146 more
Caused by: org.postgresql.util.PSQLException: FATAL: invalid value for parameter "TimeZone": "CST"
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2713)
    at org.postgresql.core.v3.QueryExecutorImpl.readStartupMessages(QueryExecutorImpl.java:2825)
    at org.postgresql.core.v3.QueryExecutorImpl.<init>(QueryExecutorImpl.java:175)
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:313)
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:54)
    at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:263)
    at org.postgresql.Driver.makeConnection(Driver.java:443)
    at org.postgresql.Driver.connect(Driver.java:297)
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
    at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358)
    at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
    at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477)
    at com.zaxxer.hikari.pool.HikariPool.access$100(HikariPool.java:71)
    at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:725)
    at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:711)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    ... 1 more
   

Tried with below setting as well however its still picking up the CST Timezone.
gone through multiple article as mentioned below but there is mostly the configuration discussed related to postgre only.

https://www.postgresql.org/message-id/[email protected]
https://www.postgresql.org/message-id/25914.1510934246%40sss.pgh.pa.us

https://postgrespro.com/list/thread-id/1543208

Set the serverTimezone for the jdbc connection string as below.

jdbc:mysql://localhost:3306/test?serverTimezone=UTC

Also current timezone for the postgre is UTC.
following are the commands used to show and set the timezone on postgre

SHOW TIMEZONE
SET TIMEZONE 'UTC'

2

Answers


  1. Chosen as BEST ANSWER

    set the timestamp UTC at the time of running the application on the cloud so that whenever the application JVM is trying to connect the postgre db it should use UTC as timestamp. Following commands are provided in the docker file which will used to while running application in the container.

    java -Duser.timezone=UTC -jar service-docker.jar
    

  2. There is no serverTimezone parameter, so the driver is using the time zone configured for your JVM. If you don’t want to change that, you can try to set the timezone parameter for the server process:

    jdbc:mysql://localhost:3306/test?options=-ctimezone=UTC
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search