Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id AC93D19DE839 for ; Wed, 7 Mar 2012 13:06:11 -0400 (AST) Received: from clust3b-eth0-0.bbone.knipp.de ([195.253.6.85] helo=kmx10a.knipp.de) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S5KJQ-00033P-CT for pgsql-jdbc@postgresql.org; Wed, 07 Mar 2012 17:06:10 +0000 Received: from localhost (localhost [127.0.0.1]) by kmx10a.knipp.de (Postfix) with ESMTP id 1442A53 for ; Wed, 7 Mar 2012 18:05:52 +0100 (MEZ) X-Knipp-VirusScanned: Yes Received: from kmx10a.knipp.de ([127.0.0.1]) by localhost (kmx10a.knipp.de [127.0.0.1]) (amavisd-new, port 10004) with ESMTP id wPSV-LyL4SZR for ; Wed, 7 Mar 2012 18:05:47 +0100 (MEZ) Received: from hp9000.do.knipp.de (hp9000.do.knipp.de [195.253.2.54]) by kmx10a.knipp.de (Postfix) with ESMTP id 13DAA50 for ; Wed, 7 Mar 2012 18:05:47 +0100 (MEZ) Received: from [195.253.2.105] (thrawn.do.knipp.de [195.253.2.105]) by hp9000.do.knipp.de (@(#)Sendmail version 8.13.3 - Revision 1.000 - 1st August, 2006/8.13.3) with ESMTP id q27H5ki3006259 for ; Wed, 7 Mar 2012 18:05:47 +0100 (MEZ) Message-ID: <4F579537.10203@knipp.de> Date: Wed, 07 Mar 2012 18:04:55 +0100 From: Michael Bauland User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: Defining local IP address when opening connections to database References: <4F578AB8.2050002@knipp.de> <03b601ccfc82$4badef60$e309ce20$@yahoo.com> In-Reply-To: <03b601ccfc82$4badef60$e309ce20$@yahoo.com> X-Enigmail-Version: 1.3.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201203/11 X-Sequence-Number: 22750 Hi David, thanks for your quick reply. > Are you missing the obvious, in which case read Kevin's and Dave's > responses, or do you mean that on the "client" machine (i.e., the one using > JDBC) you have multiple network adapters and only one of them is allowed to > connect to the database? > > If the latter is the case I am not sure about JDBC but I would presume you > could setup some form of routing table on your machine so that any traffic > to the server IP address is forced to be routed through the appropriate > network card. yes, I was referring to the latter. I have a client machine which as several network adapters, but I would like to always have the connection to the database using exactly one of the IPs available to my client. I couldn't find a way to specify this IP. Yes, the routing table might be one solution. But in my case we're actually having two services running on the client, and both connect to the same database. And both services should use a different IP. In which case the routing table won't help. There doesn't seem to be a way of doing this with JDBC, is there? Since on http://jdbc.postgresql.org/documentation/head/connect.html there are a few connection parameters, but none that lets me set my local IP for the connection. Cheers, Michael