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.