Re: Database reset connection - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: Database reset connection
Date
Msg-id CADK3HHJZFL8SzE7woxzR7bfS=Lt0s9W1NBA=LPT7x5EQ=RLKEQ@mail.gmail.com
Whole thread Raw
In response to Database reset connection  (Manoj Palhade <reply.manoj@gmail.com>)
List pgsql-jdbc

On 30 November 2016 at 06:18, Manoj Palhade <reply.manoj@gmail.com> wrote:

Hi,

I have Java class which implements the Database(Postgres) related functionality.

The problem is if Database stopped and then restart then My this class throws SQLException as connection got reset(database is up and running).

Is there any way that after Database restarted; my class automatically Connection to database and work as expected instead of throwing SQLException.

Is there anyway with Properties as a parameter to DriverManager.getConnection().

Thanks and Regards,

Manoj Palhade


It really isn't that simple. What happens if the database never comes back? This is why the application has to handle this. It should be trivial for you write a wrapper that retries intelligently to reconnect. 

Regards,



 

pgsql-jdbc by date:

Previous
From: Manoj Palhade
Date:
Subject: Database reset connection
Next
From: rob stone
Date:
Subject: Re: Database reset connection