[Gdal-dev] Connect to Postgre?

Tyler Mitchell tjmitchell at riverside.bc.ca
Fri Jun 25 18:58:57 EDT 2004


Hi Martin,
It is quite often already enabled.  I'd try using one of the command line 
utilities first to ensure it works.  I.e.:
> ogrinfo "PG:dbname=mydatabase host=giserver"

That should give you a list of layers (tables) in the db.

What language are you programming in?

Tyler

gdal-dev-bounces at xserve.flids.com wrote on 06/25/2004 01:58:44 PM:

> All,
> 
> How do I connect to a Postgre database using OGR?  In other words, 
> how do I put together my connection string to pass to 
> OGRSFDriverRegistrar::Open()?  I tried the following:
> 
> OGRSFDriverRegistrar::Open("PG:pghost=172.17.38.85;pguser=pbarker;
> pgpass=pbarker;dbname=ew", 0);
> 
> but it returns a NULL dataset.  Does anyone know what I'm doing 
> wrong?  Is Postgre support enabled in the GDAL build automatically?
> 
> Thanks, 
> 
> Martin Chapman
> Cell 303-885-1936
> Office 303-660-3933 x226
> mchapman at sanz.com
> http://www.sanz.com
> 
>  _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at xserve.flids.com
> http://xserve.flids.com/mailman/listinfo/gdal-dev




More information about the Gdal-dev mailing list