all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* failure to connect to postgres DB via pg.el
@ 2006-10-07 10:14 Martin Steffen
  2006-10-07 11:54 ` Andreas Seltenreich
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Steffen @ 2006-10-07 10:14 UTC (permalink / raw)
  Cc: pgsql-general




Hi,

I recently stumbled over the following problem, recently because the setup
worked fine for some years, only that when I changed recently to a new
linux distribution (from Suse 10 to the latest Fedora core), things broke.

The set-up is as follows:


I got a postgres data base running on a linux machine (the data base works
ok, it seems, as I can connect to it using the psql ``user interface'' to
interact with it).

I want to connect, however, via emacs, in particular, I used
to use the package 

             pg.el (Version: 0.10, 2002, it seems)

for it. Now, part of the proper use of it is establishing the
connection with the data base, which is done by:

(setq myconnection (pg:connect "data-base-name" "user-name") )

Now: this connection does no longer work, i.e., I'm refused
access, giving back the following verdict appended below the end of
the article.

Does anybody know how to repair that?  

I'm not sure where the problem lies (as said, the set-up worked with the same
version of pg.el and basically the same emacs version before). There seem two possible
sources:

  - either emacs/pg does no longer transmit my name properly (I 
      remember I had problems with encodings some time ago)

  - or postgres applies tougher access restrictions on 
     the new linux distribution, and therefore rejects me


     What is strange, however, is that I can access the
     running data base as "user-name" using the command-line
     tool psql just fine, without being rejected.



Thanks, Martin




  signal(error ("Backend error: FATAL:  Ident authentication failed for user \"user-name\"\n"))
  error("Backend error: %s" "FATAL:  Ident authentication failed for user \"msteffen\"\n")

  byte-code("..... process connection pg:SM_USER pg:SM_OPTIONS pg:SM_UNUSED generate-new-buffer " *PostgreSQL*" nil open-network-stream "postgres" fboundp set-buffer-process-coding-system binary set-buffer-multibyte vector cl-struct-pgcon 1 pg:send-int 4 2 pg:send accept-process-output 0 error "pgcon-process accessing a non-pgcon" pg:read-char 69 "Backend error: %s" pg:read-string 4096 82 pg:read-net-int pg:initialize-parsers pg:exec "SET datestyle = 'ISO'" throw --cl-block-pg:connect-- 5 "Crypt authentication not supported" "Kerberos4 authentication not supported" "Kerberos5 authentication not supported" "Can't do that type of authentication: %s" "Problem connecting: expected an authentication response" pg:SM_TTY user-packet-length host port pg:StartupPacketSize pg:PG_PROTOCOL_63_MAJOR ...] 7)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: failure to connect to postgres DB via pg.el
  2006-10-07 10:14 Martin Steffen
@ 2006-10-07 11:54 ` Andreas Seltenreich
  2006-10-07 14:55   ` Martin Steffen
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Seltenreich @ 2006-10-07 11:54 UTC (permalink / raw)


Martin Steffen writes:

> worked fine for some years, only that when I changed recently to a new
> linux distribution (from Suse 10 to the latest Fedora core), things broke.
[...]
>   - or postgres applies tougher access restrictions on 
>      the new linux distribution, and therefore rejects me
>
>      What is strange, however, is that I can access the
>      running data base as "user-name" using the command-line
>      tool psql just fine, without being rejected.
[...]
>   signal(error ("Backend error: FATAL:  Ident authentication failed for user \"user-name\"\n"))

Since pg.el only supports connections via tcp, a possible explanation
of psql's differing behavior could be that pg_hba.conf specifies
different authentication methods for unix domain and network sockets.

E.g., while SuSE used the "trust" method for local tcp connections,
Fedora might be using the "ident" method.

The pg_hba.conf file is documented here:
<http://www.postgresql.org/docs/current/static/client-authentication.html>

regards,
andreas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: failure to connect to postgres DB via pg.el
  2006-10-07 11:54 ` Andreas Seltenreich
@ 2006-10-07 14:55   ` Martin Steffen
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Steffen @ 2006-10-07 14:55 UTC (permalink / raw)
  Cc: pgsql-general

>>>>> "Andreas" == Andreas Seltenreich <seltenreich@gmx.de> writes:



    Andreas> E.g., while SuSE used the "trust" method for local tcp
    Andreas> connections, Fedora might be using the "ident" method.

yep, that was it!

Danke, Martin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: failure to connect to postgres DB via pg.el
       [not found] <mailman.7855.1160216707.9609.help-gnu-emacs@gnu.org>
@ 2006-10-08  2:20 ` Tim X
  0 siblings, 0 replies; 4+ messages in thread
From: Tim X @ 2006-10-08  2:20 UTC (permalink / raw)


Martin Steffen <msteffen@ifi.uio.no> writes:

>
>   signal(error ("Backend error: FATAL:  Ident authentication failed for user \"user-name\"\n"))
>   error("Backend error: %s" "FATAL:  Ident authentication failed for user \"msteffen\"\n")
>
>   byte-code("..... process connection pg:SM_USER pg:SM_OPTIONS pg:SM_UNUSED generate-new-buffer " *PostgreSQL*" nil open-network-stream "postgres" fboundp set-buffer-process-coding-system binary set-buffer-multibyte vector cl-struct-pgcon 1 pg:send-int 4 2 pg:send accept-process-output 0 error "pgcon-process accessing a non-pgcon" pg:read-char 69 "Backend error: %s" pg:read-string 4096 82 pg:read-net-int pg:initialize-parsers pg:exec "SET datestyle = 'ISO'" throw --cl-block-pg:connect-- 5 "Crypt authentication not supported" "Kerberos4 authentication not supported" "Kerberos5 authentication not supported" "Can't do that type of authentication: %s" "Problem connecting: expected an authentication response" pg:SM_TTY user-packet-length host port pg:StartupPacketSize pg:PG_PROTOCOL_63_MAJOR ...] 7)
>

I'm not a postgres expert, but recently when setting up a pg database
for the first time, I remember there is quite a complex set of options
for connecting to postgres. 

You have two types of connections - local unix domain sockets and tcp.
In addition to that, you have various levels of authentication (i.e.
different strengths). For example, a basic username and password or
possibly a username and password and additional verification via
identd. 

Beware the assumption that the database is OK because you can connect
via the pg command line tool. I suspect your problem is authentication
over a tcp connection. The command line pg tool almost certainly uses
unix domain sockets, but the pg.el software is using tcp ports. 

>From memory, you can get the command line pg tool to use tcp sockets
if you give it a switch. I would recommend doing that and then
debugging from there. Once you ahve it working, try pg.el again. Note
that from your error message, I suspect pg has been configured to make
a call to identd to verify you are who you say you are (i.e. a user
with that name from that IP address). Make sure identd is running and
available or change the pg config so that it doesn't use ident.

HTH

Tim
 
-- 
tcross (at) rapttech dot com dot au

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-10-08  2:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.7855.1160216707.9609.help-gnu-emacs@gnu.org>
2006-10-08  2:20 ` failure to connect to postgres DB via pg.el Tim X
2006-10-07 10:14 Martin Steffen
2006-10-07 11:54 ` Andreas Seltenreich
2006-10-07 14:55   ` Martin Steffen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.