Thread: Cannot connect though socket

Cannot connect though socket

From
"Vinicius Carvalho"
Date:
Hello there! I have a ubuntu 6.06 machine and installed the 8.1
version of postgres using apt-get.

Well. After the installation I've followed some post-installation instructions.
I've created a database called mydb, and a user with my own linux
account, all using sudo -su postgres and then using psql.

Well, here's my pg_hba.conf

# IPv4 local connections:
host    all         all         0.0.0.0 0.0.0.0          password
host    all         all         127.0.0.1/32          trust

Well, although I can connect using psql from a command line, the same
cannot be said by a jdbc connection or a pgadmin3 interface. I've
checked postgres.conf and it has the port=5432 uncommented (isn't this
enough to allow socket connections?).

Both java and pgadmin interfaces complain about: Postgres: FATAL:
password authentication failed for user "vinicius"

This is most frustrating...
Any ideas?

Best regards

Re: Cannot connect though socket

From
Sean Davis
Date:
Vinicius Carvalho wrote:
> Hello there! I have a ubuntu 6.06 machine and installed the 8.1
> version of postgres using apt-get.
>
> Well. After the installation I've followed some post-installation
> instructions.
> I've created a database called mydb, and a user with my own linux
> account, all using sudo -su postgres and then using psql.
>
> Well, here's my pg_hba.conf
>
> # IPv4 local connections:
> host    all         all         0.0.0.0 0.0.0.0          password
> host    all         all         127.0.0.1/32          trust
>
> Well, although I can connect using psql from a command line, the same
> cannot be said by a jdbc connection or a pgadmin3 interface. I've
> checked postgres.conf and it has the port=5432 uncommented (isn't this
> enough to allow socket connections?).
>
> Both java and pgadmin interfaces complain about: Postgres: FATAL:
> password authentication failed for user "vinicius"
>
> This is most frustrating...
> Any ideas?

Did you create the "vinicious" user?  If not, you will have to do that,
or connect using the postgres user.

Sean

Re: Cannot connect though socket

From
Richard Broersma Jr
Date:
> > # IPv4 local connections:
> > host    all         all         0.0.0.0 0.0.0.0          password
> > host    all         all         127.0.0.1/32          trust
> >
> > Well, although I can connect using psql from a command line, the same
> > cannot be said by a jdbc connection or a pgadmin3 interface. I've
> > checked postgres.conf and it has the port=5432 uncommented (isn't this
> > enough to allow socket connections?).

Also I would check that the postmaster is started with the -i option.
http://www.postgresql.org/docs/8.1/interactive/app-postmaster.html

it allows tcp/ip connections to your server.

Also,  I am not sure if your IP/net mask specified will allow you to connect from a remote
computer. I would try setting this to a different value.  <your client ip> <255.255.255.0> allow
all ip within that sub-net.

Regards,

Richard Broersma Jr.

Re: Cannot connect though socket

From
Tom Lane
Date:
"Vinicius Carvalho" <java.vinicius@gmail.com> writes:
> Well, here's my pg_hba.conf

> # IPv4 local connections:
> host    all         all         0.0.0.0 0.0.0.0          password
> host    all         all         127.0.0.1/32          trust

In that configuration, the second line is a no-op, because the first one
will soak up every incoming IPv4 connection and force it to do password
authentication.  pg_hba.conf lines are order-sensitive --- the usual
rule is to put the more restrictive pattern first.

> Both java and pgadmin interfaces complain about: Postgres: FATAL:
> password authentication failed for user "vinicius"

Either you didn't create a database user named "vinicius", or you didn't
give it a password, or you're supplying the wrong password from the
client side ...

            regards, tom lane

Re: Cannot connect though socket

From
Richard Broersma Jr
Date:
> Hello there! I've checked using ps and the postmaster is not running
> with the -i option. Since I'm using init.d scripts, I could not find
> the line it calls the postmaster, and I'm not being able to connect to
> the link you provide, could you explain me how to change the startup
> it with -i option?

If that is the case, I would check your init config file:

/etc/conf.d/postgresql

This is where I set the variable to the -i option.

But, before you go to far with this, just for testing purposes why not change your pg_hba.conf
settings to:

"host    all     all     <the actual ipaddress of your client> 255.255.255.0     trust"

if you can't connect with this, then *maybe* something else is wrong.

Oh,  when you reply, don't forget to copy the list.  Other can also add additional and helpful
advice.


Regards,

Richard Broersma Jr.