[FWTools] Connecting to PostgreSQL with fwtools

Frank Warmerdam warmerdam at pobox.com
Tue Jul 7 07:47:05 EST 2009


Flavio Perri - QMap srl wrote:
> dataSource = poDriver->CreateDataSource("layerName",(char**)options );
> 
> [...]
> 
> I always get a NULL dataSource, and I'm stuck.
> 
> I'm sure that OGR is capable to connect to PGSQL, because I tried the 
> tool "ogr2ogr" and it connects to PG and manipulate GIS data with a 
> simple connection string like: PG:"dbname='databasename' host='addr' 
> port='5432' user='x' passwd='y'".

Flavio,

OGR does not support creating new postgres database instances.  What
you want to do is connect to an existing instance in update mode using
OGROpen() or OGRSFDriverRegistrar::Open().

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 FWTools mailing list