Обсуждение: Re: [INTERFACES] Pgaccess - Error trying to connect
>Ed Loehr wrote> >May I suggest you search deja.com for your error message? been there, done that :-) >If that fails, you might post your error message on the mailing list and >see >what people say. Probably others struggled with the same and would >benefit from a solution... > I thought that I did explain above, but I'll start over here. Maybe I wasn't clear. I'll list every step. Please excuse the length, but I'm going around in circles here. I am logged into linux as user "don". I have PostgreSQL permissions to create databases. I have a database named "don", and I have created and populated tables in this database. PostgreSQL is always on, and works fine from the command line. (A console in X.) If I try to start pgaccess with: "pgaccess don", the main PgAccess window comes up, (empty) but there is an error message box in front of it. The message is: "Error trying to connect to database "don" on host localhost. PostgreSQL error message: Connection to database failed: Network is unreachable. is the postmaster running (with -i) at 'localhost' and accepting connections on TCP/IPport '5432'?" In the PgAccess file there is a page called "Common Problems with PgAccess" The first one is called "Connection Failure", which says: "one of the most common initial problems is the message:" (then repeats exactly the message that I just listed). It goes on to say, "This usually occurs because the "postmaster" (the postgreSQL backend) was not started with the -i option. Usually just adding -i to the command line that starts the postmaster and restarting will fix this." So I did: $su # /etc/rc.d/init.d.postgresql stop (it stops) # /etc/rc.d/init.d.postgresql start -i $ pgaccess don I still get the same error It then goes on to say, "If you have installed the prewritten script to start postgreSQL automatically, this option is (currently) commented out: # PGOPTS="-i" just remove the hash and space and comment out the "blank" option above. PGOPTS="". This line did not exist in the startup script, so I added it. PGOPTS=-i Still the same error. I can not find any other clues, so I'm stuck, and hoping someone will have another idea. TIA, Don Sorry Ed, I meant to send this to the list, then realized that I was replying to you. I'm re-sending it to the list. Don Don Oliver dayo_nanaimo@hotmail.com ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
Do a: netstat -an and check if anything is listening on port 5432. Also, try looking at your ODBC data source definition and check the hostname/IP address setting. Once you've verified this, try pinging that hostname or IP address from your DOS-prompt to see if its reachable via TCP/IP. HTH, Joe -----Original Message----- From: owner-pgsql-interfaces@postgreSQL.org [mailto:owner-pgsql-interfaces@postgreSQL.org]On Behalf Of Don Oliver Sent: Wednesday, 1 March 2000 4:20 PM To: pgsql-interfaces@postgreSQL.org Subject: Re: [INTERFACES] Pgaccess - Error trying to connect >Ed Loehr wrote> >May I suggest you search deja.com for your error message? been there, done that :-) >If that fails, you might post your error message on the mailing list and >see >what people say. Probably others struggled with the same and would >benefit from a solution... > I thought that I did explain above, but I'll start over here. Maybe I wasn't clear. I'll list every step. Please excuse the length, but I'm going around in circles here. I am logged into linux as user "don". I have PostgreSQL permissions to create databases. I have a database named "don", and I have created and populated tables in this database. PostgreSQL is always on, and works fine from the command line. (A console in X.) If I try to start pgaccess with: "pgaccess don", the main PgAccess window comes up, (empty) but there is an error message box in front of it. The message is: "Error trying to connect to database "don" on host localhost. PostgreSQL error message: Connection to database failed: Network is unreachable. is the postmaster running (with -i) at 'localhost' and accepting connections on TCP/IPport '5432'?" In the PgAccess file there is a page called "Common Problems with PgAccess" The first one is called "Connection Failure", which says: "one of the most common initial problems is the message:" (then repeats exactly the message that I just listed). It goes on to say, "This usually occurs because the "postmaster" (the postgreSQL backend) was not started with the -i option. Usually just adding -i to the command line that starts the postmaster and restarting will fix this." So I did: $su # /etc/rc.d/init.d.postgresql stop (it stops) # /etc/rc.d/init.d.postgresql start -i $ pgaccess don I still get the same error It then goes on to say, "If you have installed the prewritten script to start postgreSQL automatically, this option is (currently) commented out: # PGOPTS="-i" just remove the hash and space and comment out the "blank" option above. PGOPTS="". This line did not exist in the startup script, so I added it. PGOPTS=-i Still the same error. I can not find any other clues, so I'm stuck, and hoping someone will have another idea. TIA, Don Sorry Ed, I meant to send this to the list, then realized that I was replying to you. I'm re-sending it to the list. Don Don Oliver dayo_nanaimo@hotmail.com ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com ************
Don, The '-i' option must be given as a parameter to the postmaster command; you were giving it as a parameter to your init script, which executes the postmaster command but would not pass any parameters to it. As far as the PGOPTS variable, it may not be used in your init script (it isn't in mine, a stock RedHat 6.1 script.) Try editing the script by hand, and find the line which is of the form: su -l postgres -c "$BINDIR/postmaster -i -S -D$DATADIR" Add the '-i' if it (hopefully) isn't in there. Regards, Dave Del Signore dave@narnia.toledo.oh.us > -----Original Message----- > From: owner-pgsql-interfaces@postgreSQL.org > [mailto:owner-pgsql-interfaces@postgreSQL.org]On Behalf Of Don Oliver > Sent: Wednesday, March 01, 2000 7:20 PM > To: pgsql-interfaces@postgreSQL.org > Subject: Re: [INTERFACES] Pgaccess - Error trying to connect > > > > >Ed Loehr wrote> > >May I suggest you search deja.com for your error message? > > been there, done that :-) > > >If that fails, you might post your error message on the mailing list and > >see > >what people say. Probably others struggled with the same and would > >benefit from a solution... > > > > I thought that I did explain above, but I'll start over here. > Maybe I wasn't > clear. > I'll list every step. Please excuse the length, but I'm going around in > circles here. > > I am logged into linux as user "don". > I have PostgreSQL permissions to create databases. > > I have a database named "don", and I have created and populated tables in > this database. > PostgreSQL is always on, and works fine from the command line. (A > console in > X.) > > If I try to start pgaccess with: "pgaccess don", the main PgAccess window > comes up, > (empty) but there is an error message box in front of it. The message is: > > "Error trying to connect to database "don" on host localhost. > PostgreSQL error message: Connection to database failed: > Network is unreachable. is the postmaster running (with -i) at > 'localhost' and accepting connections on TCP/IP port '5432'?" > > In the PgAccess file there is a page called "Common Problems with > PgAccess" > The first one is called "Connection Failure", which says: > "one of the most common initial problems is the message:" > (then repeats exactly the message that I just listed). > > It goes on to say, "This usually occurs because the "postmaster" (the > postgreSQL backend) > was not started with the -i option. Usually just adding -i to the command > line that starts > the postmaster and restarting will fix this." > > So I did: > $su > # /etc/rc.d/init.d.postgresql stop > (it stops) > # /etc/rc.d/init.d.postgresql start -i > $ pgaccess don > > I still get the same error > > It then goes on to say, "If you have installed the prewritten script to > start postgreSQL > automatically, this option is (currently) commented out: > # PGOPTS="-i" > just remove the hash and space and comment out the "blank" option above. > PGOPTS="". > > This line did not exist in the startup script, so I added it. PGOPTS=-i > > Still the same error. > > I can not find any other clues, so I'm stuck, and hoping someone > will have > another idea. > > TIA, > Don > > Sorry Ed, I meant to send this to the list, then realized that I was > replying to you. I'm re-sending it to the list. Don > > > > Don Oliver > dayo_nanaimo@hotmail.com > > ______________________________________________________ > Get Your Private, Free Email at http://www.hotmail.com > > > ************ >
"Don Oliver" <dayo_nanaimo@hotmail.com> writes: > PostgreSQL is always on, and works fine from the command line. (A console in > X.) If you mean that "psql" works, that's good, but by default psql tries to connect via a Unix socket file, not via TCP/IP. So TCP connection problems won't necessarily show up. If you use the -h option then psql tries to use a TCP connection, which is what pgaccess always tries. I'll bet if you do "psql -h localhost" you see the same failure as in pgaccess. > If I try to start pgaccess with: "pgaccess don", the main PgAccess window > comes up, > (empty) but there is an error message box in front of it. The message is: > "Error trying to connect to database "don" on host localhost. > PostgreSQL error message: Connection to database failed: > Network is unreachable. is the postmaster running (with -i) at > 'localhost' and accepting connections on TCP/IP port '5432'?" The critical part of that message is the "Network is unreachable" part, which is the kernel error message that pgaccess is getting when it tries to connect. That's a pretty darn bizarre error code to get for an attempt to contact 'localhost'. I think there's something screwy in the networking configuration of your machine. Dunno what exactly; but it likely doesn't have anything directly to do with Postgres. If you do, say, "telnet localhost 23", do you get a telnet login prompt or an error? regards, tom lane