dbTalk Databases Forums  

'psql -Umyuser -h localhost mydb' vs 'psql -Umyuser mydb'

comp.databases.postgresql comp.databases.postgresql


Discuss 'psql -Umyuser -h localhost mydb' vs 'psql -Umyuser mydb' in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Barry Kline
 
Posts: n/a

Default 'psql -Umyuser -h localhost mydb' vs 'psql -Umyuser mydb' - 05-06-2010 , 09:17 AM






How does the PG back end treat local connections differently than it
does TCP/IP connections? I'm using dbi-link to connect to a remote
Oracle database. Everything works fine if I connect to the PG database
using 'psql -Umyuser mydb' but if I connect from another client (psql
-Umyuser -h mydbserver mydb) or even from the db server itself (psql
-Umyuser -h localhost mydb) I get the error:

CONTEXT: SQL statement "SELECT dbi_link.cache_connection( 1 )"
ERROR: error from Perl function "remote_select": error from Perl
function "cache_connection": DBI
connect('database=nxxc;host=mydbserver;sid=nxxc',' rpt5124',...) failed:
ORA-06413: Connection not open. (DBD ERROR: OCIServerAttach) at line 137
at line 13.

Google has given me a ton of hits on similar issues but upon further
investigation they are all with people having difficulties getting
dbi-link configured properly to talk to an Oracle database. Mine works
fine, so those hits haven't shone any light on my problem.

I've narrowed the problem down to connecting to PG via TCP/IP versus
connecting via the local port, so it must be the difference between the
two environments that is causing my issues. Apparently the trouble is
not with the Oracle environment, since the error I get is about
connections, not things I've found from Google which are more about
environmentals not being properly set.

Can anyone tell me the difference from the PG back end? Is there a
TCP/IP connection limit that may be causing me trouble? Something else
to check?

TIA,

Barry

Reply With Quote
  #2  
Old   
Andreas Kretschmer
 
Posts: n/a

Default Re: 'psql -Umyuser -h localhost mydb' vs 'psql -Umyuser mydb' - 05-07-2010 , 01:41 AM






Barry Kline <blkline (AT) attglobal (DOT) net> wrote:
Quote:
Can anyone tell me the difference from the PG back end? Is there a
TCP/IP connection limit that may be causing me trouble? Something else
to check?
Maybe you have to edit yout pg_hba.conf to enable such a connection. Can
you login with plain psql -h <server> ... ?


Andreas
--
Andreas Kretschmer
Linux - weil ich es mir wert bin!
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net

Reply With Quote
  #3  
Old   
M. Strobel
 
Posts: n/a

Default Re: 'psql -Umyuser -h localhost mydb' vs 'psql -Umyuser mydb' - 05-07-2010 , 06:21 AM



Am 06.05.2010 15:17, schrieb Barry Kline:
Quote:
How does the PG back end treat local connections differently than it
does TCP/IP connections? I'm using dbi-link to connect to a remote
Oracle database. Everything works fine if I connect to the PG database
using 'psql -Umyuser mydb' but if I connect from another client (psql
-Umyuser -h mydbserver mydb) or even from the db server itself (psql
-Umyuser -h localhost mydb) I get the error:

CONTEXT: SQL statement "SELECT dbi_link.cache_connection( 1 )"
ERROR: error from Perl function "remote_select": error from Perl
function "cache_connection": DBI
connect('database=nxxc;host=mydbserver;sid=nxxc',' rpt5124',...) failed:
ORA-06413: Connection not open. (DBD ERROR: OCIServerAttach) at line 137
at line 13.

Google has given me a ton of hits on similar issues but upon further
investigation they are all with people having difficulties getting
dbi-link configured properly to talk to an Oracle database. Mine works
fine, so those hits haven't shone any light on my problem.

I've narrowed the problem down to connecting to PG via TCP/IP versus
connecting via the local port, so it must be the difference between the
two environments that is causing my issues. Apparently the trouble is
not with the Oracle environment, since the error I get is about
connections, not things I've found from Google which are more about
environmentals not being properly set.

Can anyone tell me the difference from the PG back end? Is there a
TCP/IP connection limit that may be causing me trouble? Something else
to check?

TIA,

Barry
Have a look at your pg_hba.conf, local access is ruled by the local keyword, network
access by host and hostssl keywords.

One difference between the two access methods is that the ident authentification
is only useful on a local connection.

Max

Reply With Quote
  #4  
Old   
Barry Kline
 
Posts: n/a

Default Re: 'psql -Umyuser -h localhost mydb' vs 'psql -Umyuser mydb' - 05-07-2010 , 02:23 PM



M. Strobel wrote:


Quote:
Have a look at your pg_hba.conf, local access is ruled by the local keyword, network
access by host and hostssl keywords.

One difference between the two access methods is that the ident authentification
is only useful on a local connection.

Max
Thanks Max & Andreas for your comments. What I guess I'm looking for
is what PG is doing on the back end between the two. I can access the
server without trouble. The problem comes when PG attempts to link back
to the Oracle server. In the case where I connect via the unix domain
socket things work properly. The code fails however when I connect to
the IP socket. So that indicates to me that the two different
environments are slightly different and I was hoping that someone might
shine some light on that.

Regards,

Barry

Reply With Quote
  #5  
Old   
Jasen Betts
 
Posts: n/a

Default Re: 'psql -Umyuser -h localhost mydb' vs 'psql -Umyuser mydb' - 05-08-2010 , 05:56 AM



On 2010-05-07, M. Strobel <sorry_no_mail_here (AT) nowhere (DOT) dee> wrote:
Quote:
Am 06.05.2010 15:17, schrieb Barry Kline:

Have a look at your pg_hba.conf, local access is ruled by the local keyword, network
access by host and hostssl keywords.

One difference between the two access methods is that the ident authentification
is only useful on a local connection.
Postgres can use RFC1413 for TCP based ident authentication but this is only
useful between trusted hosts that are running ident servers.



--- news://freenews.netfront.net/ - complaints: news (AT) netfront (DOT) net ---

Reply With Quote
  #6  
Old   
Barry Kline
 
Posts: n/a

Default Re: 'psql -Umyuser -h localhost mydb' vs 'psql -Umyuser mydb' - 05-08-2010 , 01:04 PM



Jasen Betts wrote:

Quote:
Postgres can use RFC1413 for TCP based ident authentication but this is only
useful between trusted hosts that are running ident servers.
Hi Jasen.

Are you saying that pg_hba.conf has something to do with connections
between the two database servers?

Here's what I have:


Works: psql -> Local Domain Socket ----->[PG] -----> [Oracle]
^
Fails: psql -> IP Socket -----------------|


I can connect to PG from LDS or IP socket and manipulate the PG database
to which I connected with no trouble. What fails is if I call one of
the dbi-link functions to reference the remote Oracle database.

My understanding of pg_hba is that it controls the connection from the
client to the PG server but not from the PG server to a remote database
server, unless the remote is a PG database, in which case the remote's
pg_hba would have a bearing.

Am I not correct?

Thanks so much for your input!

Barry

Reply With Quote
  #7  
Old   
Matthew Woodcraft
 
Posts: n/a

Default Re: 'psql -Umyuser -h localhost mydb' vs 'psql -Umyuser mydb' - 05-08-2010 , 01:48 PM



Barry Kline <blkline (AT) attglobal (DOT) net> wrote:
Quote:
Can anyone tell me the difference from the PG back end? Is there a
TCP/IP connection limit that may be causing me trouble? Something
else to check?
I can't see why this should make a difference. The only guess I have is
that something like SELinux or AppArmor might be denying the back-end
permission to connect to the network when the initial connection didn't
need it.

But it seems most likely to be a dbi-link quirk or bug. Doesn't look
like anyone else here has any ideas, so I'd suggest the dbi-link
mailing list at http://lists.pgfoundry.org/pipermail/dbi-link-general/

-M-

Reply With Quote
  #8  
Old   
Barry Kline
 
Posts: n/a

Default Re: 'psql -Umyuser -h localhost mydb' vs 'psql -Umyuser mydb' - 05-08-2010 , 09:31 PM



Matthew Woodcraft wrote:

Quote:
I can't see why this should make a difference. The only guess I have is
that something like SELinux or AppArmor might be denying the back-end
permission to connect to the network when the initial connection didn't
need it.
That's a good idea and one I checked this morning. SELinux was set for
enforcing but I turned it off (and even rebooted!) with the same result.


Quote:
But it seems most likely to be a dbi-link quirk or bug. Doesn't look
like anyone else here has any ideas, so I'd suggest the dbi-link
mailing list at http://lists.pgfoundry.org/pipermail/dbi-link-general/
Just got myself subscribed to that list and I'm going to move the
problem over to there.

Thanks so much Matthew.

Barry

Reply With Quote
  #9  
Old   
Jasen Betts
 
Posts: n/a

Default Re: 'psql -Umyuser -h localhost mydb' vs 'psql -Umyuser mydb' - 05-09-2010 , 06:43 AM



On 2010-05-08, Barry Kline <blkline (AT) attglobal (DOT) net> wrote:
Quote:
Jasen Betts wrote:

Postgres can use RFC1413 for TCP based ident authentication but this is only
useful between trusted hosts that are running ident servers.

Hi Jasen.

Are you saying that pg_hba.conf has something to do with connections
between the two database servers?
"host" is a generic term meaning basically a computer or other
networked device.

Quote:
Here's what I have:


Works: psql -> Local Domain Socket ----->[PG] -----> [Oracle]
^
Fails: psql -> IP Socket -----------------|
the pg_hba.conf on host PG file only effects logins to the postgresql
service on that host

Quote:
I can connect to PG from LDS or IP socket and manipulate the PG database
to which I connected with no trouble. What fails is if I call one of
the dbi-link functions to reference the remote Oracle database.
Run the query "show all;" through both connections and look for
diferences, a postgres session has quite a lot of "state" and it may
be a part other than the authentication method or type of socket that
is causing trouble.

Quote:
My understanding of pg_hba is that it controls the connection from the
client to the PG server but not from the PG server to a remote database
server, unless the remote is a PG database, in which case the remote's
pg_hba would have a bearing.

Am I not correct?
yes, but oracle probably uses some other system to decide who logs on.


--- news://freenews.netfront.net/ - complaints: news (AT) netfront (DOT) net ---

Reply With Quote
  #10  
Old   
Barry Kline
 
Posts: n/a

Default Re: 'psql -Umyuser -h localhost mydb' vs 'psql -Umyuser mydb' - 05-09-2010 , 06:28 PM



Jasen Betts wrote:

Quote:
Run the query "show all;" through both connections and look for
diferences, a postgres session has quite a lot of "state" and it may
be a part other than the authentication method or type of socket that
is causing trouble.
That was an excellent idea Jasen. I did it to two different output
files, but I don't think it's going to offer any clues:

[root@crpsvsql001 tmp]# diff ip_socket unix_domain_socket
162,164c162,164
< tcp_keepalives_count | 9
Quote:
Maximum number of TCP keepalive retransmits.
tcp_keepalives_idle | 7200
Time between issuing TCP keepalives.
tcp_keepalives_interval | 75
Time between TCP keepalive retransmits.
---
tcp_keepalives_count | 0
Maximum number of TCP keepalive retransmits.
tcp_keepalives_idle | 0
Time between issuing TCP keepalives.
tcp_keepalives_interval | 0
Time between TCP keepalive retransmits.
[root@crpsvsql001 tmp]#


The only differences are what I'd expect between the two connection methods.

Regards,

Barry

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.