Bug 56564 - pgaccess cannot connect to database
Summary: pgaccess cannot connect to database
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: postgresql   
(Show other bugs)
Version: 7.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Trond Eivind Glomsrxd
QA Contact: David Lawrence
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-11-21 00:53 UTC by Daniel Hammer
Modified: 2007-04-18 16:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-11-21 03:22:25 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Daniel Hammer 2001-11-21 00:53:46 UTC
$ pgaccess {database} fails with the following error message:

"Connection to database failed
 connectDBStart() -- connect() failed:
 Connection refused"

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. su postgres
2. createdb {database}
3. createuser {user}
4. $ pgaccess {database} (performed as {user})
	

Actual Results:  a popup-window shows the following text:

"Connection to database failed
 connectDBStart() -- connect() failed:
 Connection refused
 Is the postmaster running (with -i) at 'localhost'
 and accepting connections on TCP/IP port 5432?"


Proposal for a fix:

(a) There is a way to avoid this: just doing $ pgaccess
and deleting manually "localhost" from the popup-window
and manually open the db {database}.

 (b) A much more elegant way to fix the problem would be
to do some little changes in the starting script for the 
daemon: /etc/rc.d/init.d/postgresql.

Change line 62/63 from

 start(){
	PSQL_START=$"Starting postgresql service: "

to

 start(){
	PSQL_START=$"Starting postgresql service: "
	PGOPTS="-i"

and line 135 from 

 su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl -D $PGDATA -p
    /usr/bin/postmaster start  > /dev/null 2>&1" < /dev/null

to 

 su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl -D $PGDATA -p
   /usr/bin/postmaster -o $PGOPTS start  > /dev/null 2>&1" < /dev/null

Comment 1 David Lawrence 2001-11-21 03:22:19 UTC
The preferred way to enable options with PostgreSQL is to edit the config file
located at /var/lib/pgsql/data/postgresql.conf. There you will find a line such as

#tcpip_socket = false

Just uncomment the line and restart PostgreSQL. This will automatically add the
-i and allow pgaccess to work properly.

Comment 2 Daniel Hammer 2001-11-21 10:45:49 UTC
Thanx for the prompt answer.
I have tried this before! But, unfortunately, following the steps of 
your suggestion above, this does not work: the postmaster continues 
to start as 
/usr/bin/postmaster -D /var/lib/pgsql/data 
and I continue being denied to get access to the database via pgaccess 
(in the way as I indicated it above).

I've tried this now on several machines with a fresh install and the
following relevant packages installed:

postgresql-7.1.3-2 
postgresql-contrib-7.1.3-2 
postgresql-devel-7.1.3-2 
postgresql-docs-7.1.3-2 
postgresql-jdbc-7.1.3-2 
postgresql-libs-7.1.3-2 
postgresql-odbc-7.1.3-2 
postgresql-perl-7.1.3-2 
postgresql-python-7.1.3-2 
postgresql-server-7.1.3-2 
postgresql-tcl-7.1.3-2 
postgresql-tk-7.1.3-2 
mod_auth_pgsql-0.9.8-1
perl-DBD-Pg-1.01-1 
php-pgsql-4.0.6-7 

and always got the same result.

So this does not work 'n' nothing has changed.


Comment 3 Daniel Hammer 2001-11-21 12:36:43 UTC
Ok., sorry for bothering again. 
The (one) right way is to set "tcpip_socket = true"
in
 
/var/lib/pgsql/data/postgresql.conf

to get local access to PostgreSQL. I didn't test 
network access yet, but TCP-port 5432 is open - so
it seems to look good.

But anyway, postmaster seems to start without -i
option:

[root@tunix data]# ps -fu postgres
UID        PID  PPID  C STIME TTY          TIME CMD
postgres  3455     1  0 13:22 pts/2    00:00:00 /usr/bin/postmaster -D  
/var/lib/pgsql/data
postgres  3488  3455  0 13:24 pts/2    00:00:00 postgres: hombre Luach 127.0.0.1
idle     

So, it works. With the changed start script for the daemon as
indicated above the postmaster however starts with "-i" option:

[root@tunix data]#  ps -fu postgres
UID        PID  PPID  C STIME TTY          TIME CMD
postgres  3712     1  0 13:30 pts/2    00:00:00 /usr/bin/postmaster -D
/var/lib/pgsql/data -i
postgres  3724  3712  0 13:30 pts/2    00:00:00 postgres: hombre Luach 127.0.0.1
idle        

In both cases I can locally connect to a database.
But thanx for your help!


Note You need to log in before you can comment on or make changes to this bug.