[mapserver-users] ogr connection to postgis problems

Travis Kirstine traviskirstine at gmail.com
Wed Mar 25 14:51:39 EDT 2009


2009/3/25 Stephen Woodbridge <woodbri at swoodbridge.com>:
> Jeff McKenna wrote:
>>
>> Travis Kirstine wrote:
>>>
>>> I am trying to test a connection to a postgis db  using ogrinfo and am
>>> having difficulties.  I am running the command on the same server that
>>> hosts the postgis db.  I checked the pg_hba.config file to see if it
>>> allows local connections and everything looks OK but I still get
>>> "Failure" when connecting with ogr.
>>>
>>> Am I missing something?
>>>
>>>
>>> command
>>> ogrinfo -ro PG:'host=server34 dbname=earth user=bob password=suruncle'
>>>
>>>
>>
>> My thoughts:
>>
>> - since you are on the same server, use host=127.0.0.1
>> - include the port parameter (usually port=5432)
>
> Have you try from the command line:
>
> psql -h server34 -U bob earth
> psql -h localhost -U bob earth
> psql -U bob earth
>
> Should prompt you for the password.
>
> Only the last on will use the local socket or named pipe. If the last one
> works the try:
>
> ogrinfo -ro PG:'host= dbname=earth user=bob password=suruncle'
> ogrinfo -ro PG:'dbname=earth user=bob password=suruncle'
>
> and see if either of these work.
>

I got the query / connection to work, it seems that the -ro flag was
causing the problem
which is strange.

this works
ogrinfo -sql 'SELECT * FROM counties' PG:'host= dbname=earth user=bob
password=suruncle'

this dosen't
ogrinfo -ro -sql 'SELECT * FROM counties' PG:'host= dbname=earth
user=bob password=suruncle'

I'm not sure what the problem is as the user bob has su privileges


                               List of roles
 Role name | Superuser | Create role | Create DB | Connections | Member of
-----------+-----------+-------------+-----------+-------------+-----------
 postgres  | yes       | yes         | yes       | no limit    |
 bob          | yes       | no          | yes       | no limit    |



-- 
Travis K.

Toronto, Canada
------------------------------------------------------------
"She knows there's no success like failure
and that failure's no success at all."
-Bob Dylan-
------------------------------------------------------------


More information about the mapserver-users mailing list