[GRASSLIST:4255] Re: DBMI-Postgres driver error - solved?

Martin Wegmann wegmann at biozentrum.uni-wuerzburg.de
Thu Aug 26 07:05:56 EDT 2004


I don't know why it works today. I restarted my computer and did just out of 
curiousity db.test test1 and get: 

D3/5: token 2 : user=baliola
D3/5: host = 127.0.0.1, port = (null), options = (null), tty = (null), dbname 
= grass_test, user = baliola, password = (null)
D3/5: pgtype = 16,      name = bool ->  type = 16
D3/5: pgtype = 18,      name = char ->  type = 9
D3/5: pgtype = 20,      name = int8 ->  type = 3
D3/5: pgtype = 21,      name = int2 ->  type = 1
D3/5: pgtype = 23,      name = int4 ->  type = 2
D3/5: pgtype = 25,      name = text ->  type = 12
D3/5: pgtype = 26,      name = oid ->   type = 5
D3/5: pgtype = 700,     name = float4 ->        type = 6
D3/5: pgtype = 701,     name = float8 ->        type = 7
D3/5: pgtype = 1042,    name = bpchar ->        type = 10
D3/5: pgtype = 1043,    name = varchar ->       type = 11
D3/5: pgtype = 1082,    name = date ->  type = 13
D3/5: pgtype = 1083,    name = time ->  type = 14
D3/5: pgtype = 1114,    name = timestamp ->     type = 15
D3/5: pgtype = 1700,    name = numeric ->       type = 8
D3/5: sql: drop table grass_test1

D3/5: Escaped SQL: drop table grass_test1

EXECUTE: OK

well, that looks like postgres is working now. might the reboot be the 
explanation why it is working now? (after having changed "ident" to "trust" 
in the pg_hba.conf)
anyway, now I will explorer the world of postgres and GRASS ,-)

Martin

On Wednesday 25 August 2004 15:47, Martin Wegmann wrote:
> On Wednesday 25 August 2004 15:11, Radim Blazek wrote:
> > Does 'psql -h 127.0.0.1 -U baliola grass_test' work?
>
> no, I get
> psql -h 127.0.0.1 -U baliola grass_test
> psql: FATAL:  IDENT authentication failed for user "baliola"
>
> well, I assume it is rather a postgresql problem (better: rather a postgres
> newbie user problem ,-)  ) - if nobody knows the answer on this ML I will
> post onto the PGSQL ML.
>
> > Try to run
> >  g.gisenv set=DEBUG=5
> >  db.tables -p
> > to see if database definition is parsed well.
>
> GRASS 5.7.0:~ > g.gisenv set=DEBUG=5
> GRASS 5.7.0:~ > db.tables -p
> D3/5: db_driver_open_database() driver=pg database definition =
> 'host=127.0.0.1,dbname=grass_test,user=baliola'
> D3/5: parse_conn : host=127.0.0.1,dbname=grass_test,user=baliola
> D3/5: token 0 : host=127.0.0.1
> D3/5: token 1 : dbname=grass_test
> D3/5: token 2 : user=baliola
> D3/5: host = 127.0.0.1, port = (null), options = (null), tty = (null),
> dbname = grass_test, user = baliola, password = (null)
> D3/5: User/password missing
> DBMI-Postgres driver error:
> cannot get user/password
>
>
> cheers Martin
>
> > Radim
> >
> > On Wednesday 25 August 2004 14:47, Martin Wegmann wrote:
> > > On Tuesday 24 August 2004 08:17, Sabine Grabner wrote:
> > > > hello martin, `trust` is possibly not what you want, as your data are
> > > > not safe in this case. i used `md5`.
> > >
> > > well at the moment it is not important that the data is safe - it's
> > > just a trial on my computer.
> > > Despite the change to trust I still get the error messages.
> > > I listed below what I did:
> > >
> > > I replaced "ident" in /etc/postgresql/pg_hba.conf to "trust" where
> > > localhost:
> > >
> > > # TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
> > > METHOD # Database administrative login by UNIX sockets
> > > local   all         postgres                                       
> > > ident sameuser
> > > #
> > > # All other connections by UNIX sockets
> > > local   all         all                                            
> > > ident sameuser
> > > #
> > > # All IPv4 connections from localhost
> > > host    all         all         127.0.0.1         255.255.255.255  
> > > trust sameuser
> > > #
> > > # All IPv6 localhost connections
> > > host    all         all         ::1
> > > ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff        trust sameuser
> > > host    all         all         ::ffff:127.0.0.1/128               
> > > trust sameuser
> > > #
> > > # reject all other connection attempts
> > > host    all         all         0.0.0.0           0.0.0.0
> > > reject
> > >
> > > psql grass_test
> > > create user baliola;
> > >
> > > grass_test=# select * from pg_shadow;
> > >  usename  | usesysid | usecreatedb | usesuper | usecatupd | passwd |
> > > valuntil
> > >
> > > | useconfig
> > >
> > > ----------+----------+-------------+----------+-----------+--------+---
> > >-- -- ---+----------- postgres |        1 | t           | t        | t
> > >
> > >
> > >
> > >  baliola  |      100 | f           | f        | f         |        |
> > >
> > > (2 rows)
> > >
> > >
> > > but when I start grass57 and do:
> > >
> > > GRASS 5.7.0:~ > db.connect driver=pg
> > > database="host=127.0.0.1,dbname=grass_test,user=baliola"
> > > driver:pg
> > > database:host=127.0.0.1,dbname=grass_test,user=baliola
> > >
> > > db.test test1
> > >
> > > create table grass_test1 (i1 integer, d1 double precision, c1
> > > varchar(20)) DBMI-Postgres driver error:
> > > cannot get user/password
> > > [....]
> > > EXECUTE: ******** ERROR ********
> > > 0a1,3
> > >
> > > > 1|123.456000|abcd|
> > > > 3|0.000000|_\'_|
> > > > 2|18.600000|xxx|987
> > >
> > > RESULT: ******** ERROR ********
> > > drop table grass_test1
> > > DBMI-Postgres driver error:
> > > cannot get user/password
> > >
> > > any idea what I did wrong?
> > > Cheers Martin
> > >
> > > > Zitat von Martin Wegmann <wegmann at biozentrum.uni-wuerzburg.de>:
> > > > > On Monday 23 August 2004 16:23, Radim Blazek wrote:
> > > > > > And 'psql -h localhost grass_test'?
> > > > > > Maybe you need to edit pg_hba.conf.
> > > > >
> > > > > psql -h localhost grass_test
> > > > > psql: FATAL:  IDENT authentication failed for user "baliola"
> > > > >
> > > > > the non # part of pg_hba.conf looks like:
> > > > >
> > > > > #
> > > > > # TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK
> > > > > METHOD # Database administrative login by UNIX sockets
> > > > > local   all         postgres
> > > > > ident sameuser
> > > > > #
> > > > > # All other connections by UNIX sockets
> > > > > local   all         all
> > > > > ident sameuser
> > > > > #
> > > > > # All IPv4 connections from localhost
> > > > > host    all         all         127.0.0.1         255.255.255.255
> > > > > ident sameuser
> > > > > #
> > > > > # All IPv6 localhost connections
> > > > > host    all         all         ::1
> > > > > ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff        ident sameuser
> > > > > host    all         all         ::ffff:127.0.0.1/128
> > > > > ident sameuser
> > > > > #
> > > > > # reject all other connection attempts
> > > > > host    all         all         0.0.0.0           0.0.0.0
> > > > > reject
> > > > >
> > > > > I assume I have to change the 3. and 4. connection (localhost) from
> > > > > ident to
> > > > >
> > > > > trust .
> > > > >
> > > > > Martin
> > > > >
> > > > > > Radim
> > > > > >
> > > > > > On Monday 23 August 2004 13:54, Martin Wegmann wrote:
> > > > > > > hello Radim,
> > > > > > >
> > > > > > > On Monday 23 August 2004 12:43, Radim Blazek wrote:
> > > > > > > > GRASS cannot store passwords, if your DB requires a password
> > > > > > > > add it to the database parameter. Try psql first.
> > > > > > >
> > > > > > > The user is set up as a non-passwd user ('with password' is not
> > > > > > > used) I can enter psql grass_test without being prompted for a
> > > > > > > password.
> > > > > > >
> > > > > > > baliola at diomedea:~$ psql grass_test
> > > > > > > Welcome to psql 7.4.3, the PostgreSQL interactive terminal.
> > > > > > >
> > > > > > > Type:  \copyright for distribution terms
> > > > > > >        \h for help with SQL commands
> > > > > > >        \? for help on internal slash commands
> > > > > > >        \g or terminate with semicolon to execute query
> > > > > > >        \q to quit
> > > > > > >
> > > > > > > grass_test=#
> > > > > > >
> > > > > > > drop user baliola and created a new user with specifying a
> > > > > > > passwd: create user baliola with password 'test';
> > > > > > > however psql is not prompting for as passwd when entering the
> > > > > > > grass_test db.
> > > > > > >
> > > > > > > exit postgres and superuser -- starting grass57 as baliola
> > > > > > >
> > > > > > > db.connect driver=pg
> > > > > > > database="host=localhost,dbname=grass_test,user=baliola,passwor
> > > > > > >d= te st " driver:pg
> > > > > > > database:host=localhost,dbname=grass_test,user=baliola,password
> > > > > > >=t es t
> > > > > > >
> > > > > > > db.tables -p
> > > > > > > DBMI-Postgres driver error:
> > > > > > > Cannot connect to Postgres: FATAL:  IDENT authentication failed
> > > > > > > for user "baliola"
> > > > > > >
> > > > > > > I did it as well with ' around the password phrase -- same
> > > > > > > result.
> > > > > > >
> > > > > > > Martin
> > > > > > >
> > > > > > > > Radim
> > > > > > > >
> > > > > > > > On Monday 23 August 2004 11:55, Martin Wegmann wrote:
> > > > > > > > > hello,
> > > > > > > > >
> > > > > > > > > I did my first steps with postgresql and grass and ran into
> > > > > > > > > some problems: First I created an user and set up a db
> > > > > > > > > ("grass_test")
> > > > > > > > >
> > > > > > > > > starting grass (5.7.0):
> > > > > > > > > db.connect driver=pg
> > > > > > > > > database="host=localhost,dbname=grass_test,user=baliola"
> > > > > > > > >
> > > > > > > > > I am not sure if "host=localhost" is correct. In all
> > > > > > > > > documents I
> > > > >
> > > > > read
> > > > >
> > > > > > > > > so far, an IP address was specified but using 127.0.0.1
> > > > > > > > > resulted in the same error prompt. What do I enter when
> > > > > > > > > postgresql is running locally?
> > > > > > > > >
> > > > > > > > > If I proceed and do  'db.test grass_test' then db.test
> > > > > > > > > tells me that the db must exist.
> > > > > > > > > If I do db.test test1 I get:
> > > > > > > > >
> > > > > > > > > DBMI-Postgres driver error:
> > > > > > > > > cannot get user/password
> > > > > > > > >
> > > > > > > > > and various Postgresql commands
> > > > > > > > >
> > > > > > > > > Any idea how to solve that?
> > > > > > > > >
> > > > > > > > > I am still searching for a tutorial introducing people to
> > > > > > > > > the postgresql inside GRASS usage, so far I found
> > > > > > > > > http://mpa.itc.it/markus/shortcourse/notes6.html  and
> > > > > > > > > the GRASS 5.7 usage example document. any links are
> > > > > > > > > welcome.
> > > > > > > > >
> > > > > > > > > regards, Martin




More information about the grass-user mailing list