Hello everyone,<br>I used FWTools in my program to manipulate shapefiles and it worked fine. Now I'd like to use a DB(Postgres/PostGis) to read and write GIS data tables. <br>i'm developing with the last release (2.4.2) and unfortunately I cannot find a right solution to connect to PGSQL. <br>
<br>First, I got the driver "PostgreSQL", then I tried to connect to the DBserver using the function CreateDataSource().<br><br>[...]<br><br> char options[5][256];<br><br> <br> sprintf(options[0],"dbname='%s'",dbServerName);<br>
sprintf(options[1],"host='%s'",dbHostAddress);<br> sprintf(options[2],"port='%s'",port);<br> sprintf(options[3],"user='%s'",userName);<br> sprintf(options[4],"passwd='%s'",password);<br>
<br>dataSource = poDriver->CreateDataSource("layerName",(char**)options );<br><br>[...]<br><br>I always get a NULL dataSource, and I'm stuck. <br><br>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: <font size="2">PG:"dbname='databasename' host='addr' port='5432' user='x' passwd='y'".<br>
<br><br>Any hint? <br><br>Thanks in advance,<br>Flavio<br></font>