Обсуждение: Setup and LIBPQ (Newbie)

Поиск
Список
Период
Сортировка

Setup and LIBPQ (Newbie)

От
Bruce Tong
Дата:
I've starting writing some code against LIBPQ and the PQsetdb() call
doesn't establish a connection. I get the following error message when I
ran my program:

"Failed to authenticate client as Postgres user 'zztong' using the default
authentication type: be_recvauth: host-based authentication failed"

Then I ran "psql mydb" under my "zztong" login and it worked. So, I ran my
program again and got a different message:

"PQexec() -- Request was sent to backend, but backend cloased the channel
before responding. This probably means the backend terminated abnormally
before or while processing the request."

My call to PQsetdb is...

theConnection = PQsetdb( "vishnu.ev.net", "5432", NULL, NULL, "mydb" );

I'm running Postgres 6.2.1 as it comes installed with Red Hat Linux v5.0.

Q: I saw somebody recommend a "-i" option for what seemed like a similar
situation, but I don't see that option on the man pages. Is it related to
my problem?

Q: Attempts to use MS-Access with the PostODBC driver failed. Could this
be related?

I'm new to PostgreSQL and administrating any type of SQL-DB server.
Extended explanations are appreciated as are corrections to inaccurate
things I may have said.


Bruce Tong
Systems Programmer
Electronic Vision / FITNE

mailto: zztong@laxmi.ev.net
http://www.ev.net/fitne


Re: [ADMIN] Setup and LIBPQ (Newbie)

От
Peter Mount
Дата:
On Tue, 12 May 1998, Bruce Tong wrote:

> I've starting writing some code against LIBPQ and the PQsetdb() call
> doesn't establish a connection. I get the following error message when I
> ran my program:
>
> "Failed to authenticate client as Postgres user 'zztong' using the default
> authentication type: be_recvauth: host-based authentication failed"

Check that you have pg_hba.conf setup correctly.

> Q: I saw somebody recommend a "-i" option for what seemed like a similar
> situation, but I don't see that option on the man pages. Is it related to
> my problem?

running postmaster with -i enables communication via tcp-ip sockets. The
JDBC & ODBC drivers need this to operate.

> Q: Attempts to use MS-Access with the PostODBC driver failed. Could this
> be related?

Yes (see above)

--
Peter T Mount peter@retep.org.uk or petermount@earthling.net
Main Homepage: http://www.retep.org.uk
************ Someday I may rebuild this signature completely ;-) ************
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk


Re: [ADMIN] Setup and LIBPQ (Newbie)

От
Bruce Tong
Дата:
> Check that you have pg_hba.conf setup correctly.

Ahh, there's the config file. Cool. I learned a couple of things about
PostgreSQL finding it. Okay, the default should have let anything on the
same host connect, and that was true with the "psql" application.

This gives me some things to try. Thanks. I can't figure out why I didn't
see this file before since I've been to that directory. I don't remember
it being mentioned in the Administrator's Docs. Oh well. ;)

> > Q: I saw somebody recommend a "-i" option for what seemed like a similar
> > situation, but I don't see that option on the man pages. Is it related to
> > my problem?
>
> running postmaster with -i enables communication via tcp-ip sockets. The
> JDBC & ODBC drivers need this to operate.

> > Q: Attempts to use MS-Access with the PostODBC driver failed. Could this
> > be related?
>
> Yes (see above)

The "-i" option doesn't seem to be known by the /usr/bin/postmaster
application. It doesn't recognise the option and it is not in the man
pages. The PG_VERSION file says 6.1, but the software package manager
(RPM) tells me I've got version 6.2.1. Is the "-i" option part of a later
version?


Bruce Tong
Systems Programmer
Electronic Vision / FITNE

mailto: zztong@laxmi.ev.net
http://www.ev.net/fitne


Re: [ADMIN] Setup and LIBPQ (Newbie)

От
Peter Mount
Дата:
On Tue, 12 May 1998, Bruce Tong wrote:

[snip]

> The "-i" option doesn't seem to be known by the /usr/bin/postmaster
> application. It doesn't recognise the option and it is not in the man
> pages. The PG_VERSION file says 6.1, but the software package manager
> (RPM) tells me I've got version 6.2.1. Is the "-i" option part of a later
> version?

Ah, -i came in V6.3. Before that there was only TCP/IP, but 6.3 has
UnixDomain sockets as well, and TCP/IP has to be enabled with -i

In my pg_hba.conf file, the line begining with local is for 6.3 onwards
and relates to UnixDomain sockets

--
Peter T Mount peter@retep.org.uk or petermount@earthling.net
Main Homepage: http://www.retep.org.uk
************ Someday I may rebuild this signature completely ;-) ************
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk