Re: Defining local IP address when opening connections to database

From: Scott Harrington <scotth01(at)sns-usa(dot)com>
To: Michael Bauland <Michael(dot)Bauland(at)knipp(dot)de>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Defining local IP address when opening connections to database
Date: 2012-03-07 19:08:33
Message-ID: alpine.WNT.2.00.1203071356590.6596@turks
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Wed, 7 Mar 2012, Michael Bauland wrote:

> I've got a problem when using the PostgreSQL JDBC driver to open a
> connection to a database (not using SSL). The server on which I'm using
> the driver has several IPs configured, but I would like to use a certain
> IP (since only for that IP the firewalls have been set-up to allow the
> connection to the database). Looking at the documentation I couldn't
> find a way to define this local IP.
> Have I missed something? If not, would it be possible to add this
> feature of defining the local IP when setting up a connection?

You haven't missed anything. I had the same requirement a while ago and
needed to patch (see attached) my local build to bind to a localAddress
specified in the JDBC properties.

I find it useful to bind to a particular local address not only for
routing but also simply to improve the connection logs.

Hope this helps.

Attachment Content-Type Size
pgjdbc-localAddress.patch application/octet-stream 5.4 KB

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message John R Pierce 2012-03-07 19:55:21 Re: Defining local IP address when opening connections to database
Previous Message Michael Bauland 2012-03-07 17:04:55 Re: Defining local IP address when opening connections to database