Skip site navigation (1) Skip section navigation (2)

Simple connection failover support

From: Mikko Tiihonen <mikko(dot)tiihonen(at)nitorcreations(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Simple connection failover support
Date: 2012-05-22 13:37:21
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

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


Attachment: 0001-Change-String-host-int-port-to-InetSocketAddress-add.patch
Description: text/x-patch (0 bytes)


pgsql-jdbc by date

Next:From: OTSUKA KenjiDate: 2012-05-25 01:50:27
Subject: a difference of version information 9.1-902 jar and source
Previous:From: Craig RingerDate: 2012-05-22 04:53:32
Subject: Re: json type

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group