From: Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>
To: pgsql-jdbc@postgresql.org
Subject: Simple connection failover support
Date: Tue, 22 May 2012 16:37:21 +0300
Message-ID: <4FBB9691.50008@nitorcreations.com> (raw)
Hi,
Here are two patches that add simple failover support to the jdbc driver.
Patch 1 converts all references to pair of host+port variables to single InetSocketAddress
Patch 2 rewrites the url parsing to support multiple host:port pairs and modifies the low level connection opening to retry once all listed addresses
I also added more cases to the unit tests to verify that I did not break any functionality.
* The connection url and connection parameters stay backwards compatible
* If there are commas in the hostname part of the url the new code will use them to split the addresses and keep them in the defined priority order
* If there is any IOException or login failure during the connection phase the code will try another listed address
* I tried to keep the code still Java 1.4 compatible
-Mikko
Attachments:
0001-Change-String-host-int-port-to-InetSocketAddress-add.patch (text/x-patch, 0B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: mikko.tiihonen@nitorcreations.com
Subject: Re: Simple connection failover support
In-Reply-To: <4FBB9691.50008@nitorcreations.com>
References: <4FBB9691.50008@nitorcreations.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox