Frank: Thanks for the reply. I tried again with" strcat(connectBuf, "PG:dbname='postgis' host='<hostname>' port='5432' user='postgres' password='>Pwd>'");
*dataSource = OGRSFDriverRegistrar::Open(connectBuf /*connectString.c_str() */, FALSE); And still no connection and *dataSource was returned NULL. I put a breakpoint in GdalErrorHandler and the code did not go there so apparently no error was signaled during the connection attempt I also tried: L:\SupportLibraries\gdal-1.7.1\bin\release>ogrinfo -ro PG:"host=<hostname> user=postgres password=<pwd>" FAILURE: Unable to open datasource `PG:host=<hostname> user=postgres password=<pwd>' with the following drivers. -> ESRI Shapefile -> MapInfo File -> UK .NTF -> SDTS -> TIGER -> S57 -> DGN -> VRT -> REC -> Memory -> BNA -> CSV -> GML -> GPX -> KML -> GeoJSON -> GMT -> ODBC -> PGeo -> PostgreSQL -> PCIDSK -> XPlane -> AVCBin -> AVCE00 -> DXF -> Geoconcept -> GeoRSS -> GPSTrackMaker -> VFK From the list we can see PostgrSQL but no reason was given for the failure Any other suggestions would be greatly appreciated. Bruce -----Original Message----- From: Frank Warmerdam [mailto:[email protected]] Sent: Thursday, September 23, 2010 5:05 PM To: Clay, Bruce Cc: [email protected] Subject: Re: [gdal-dev] can not connect top postgis db using GDAL 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, [email protected] light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush | Geospatial Programmer for Rent This message and any enclosures are intended only for the addressee. Please notify the sender by email if you are not the intended recipient. If you are not the intended recipient, you may not use, copy, disclose, or distribute this message or its contents or enclosures to any other person and any such actions may be unlawful. Ball reserves the right to monitor and review all messages and enclosures sent to or from this email address. _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
