[gdal-dev] can not connect top postgis db using GDAL

Frank Warmerdam warmerdam at pobox.com
Thu Sep 23 17:05:05 EDT 2010


Clay, Bruce wrote:
> I can not connect to a posgresql/postgis database using GDAL.  I have 
> verified that the PostgreSql drivers are in the DLL by calling ogrinfo 
> –formats.
> 
> PostgreSql is on the list
> 
>  
> 
> From c++ code I try the following:
> 
>  
> 
> strcat(connectBuf, "PG:\"dbname='postgis' host='<ip address' port='5432' 
> user='postgres' password='<pwd>'\"");

Bruce,

You should not be including the extra escaped double quotes in the connection
string.  You likely saw an example in this form intended for use at the
commandline where the quotes would be interpreted by the shell, and keep the
whole connection string together as one argument.  Try:


strcat(connectBuf, "PG:dbname='postgis' host='<ip address' port='5432' 
user='postgres' password='<pwd>'");

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list