Reputation: 67
My application running on virtual server, and addressing to Postgres DB through Hibernate which deployed on Heroku. Every several days my application stops with console message:
Jan 09, 2020 3:36:18 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 0, SQLState: 57P01
Jan 09, 2020 3:36:18 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: FATAL: terminating connection due to administrator command
Jan 09, 2020 3:36:18 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 0, SQLState: 08006
Jan 09, 2020 3:36:18 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: An I/O error occured while sending to the backend.
Jan 09, 2020 3:36:18 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 0, SQLState: 08003
Jan 09, 2020 3:36:18 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: This connection has been closed.
My hibernate.cfg.xml:
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql:url</property>
<property name="hibernate.connection.username">user</property>
<property name="hibernate.connection.password">pass</property>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQL94Dialect</property>
<property name="show_sql">true</property>
<property name="hibernate.c3p0.idle_test_period">300</property><property name="hibernate.c3p0.timeout">3000</property>
<property name="hibernate.c3p0.max_size">15</property>
<property name="hibernate.c3p0.min_size">3</property>
<property name="hibernate.c3p0.max_statements">0</property>
<property name="hibernate.c3p0.testConnectionOnCheckout">true</property>
<property name="hibernate.c3p0.preferredTestQuery">select 1;</property>
</session-factory>
</hibernate-configuration>
Appreciate any helpful advice.
Upvotes: 2
Views: 14399
Reputation: 246463
That looks like either the database server is restarted or your database connection is killed by the administrator.
Check the PostgreSQL log file for restarts and ask your DBA.
Your application should be programmed so that it can automatically reconnect to the database when the database connection goes bad.
Upvotes: 4