Hello everyone,<br>I used FWTools in my program to manipulate shapefiles and it worked fine. Now I&#39;d like to use a DB(Postgres/PostGis) to read and write GIS data tables. <br>i&#39;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 &quot;PostgreSQL&quot;, 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],&quot;dbname=&#39;%s&#39;&quot;,dbServerName);<br>
    sprintf(options[1],&quot;host=&#39;%s&#39;&quot;,dbHostAddress);<br>    sprintf(options[2],&quot;port=&#39;%s&#39;&quot;,port);<br>    sprintf(options[3],&quot;user=&#39;%s&#39;&quot;,userName);<br>    sprintf(options[4],&quot;passwd=&#39;%s&#39;&quot;,password);<br>
<br>dataSource = poDriver-&gt;CreateDataSource(&quot;layerName&quot;,(char**)options );<br><br>[...]<br><br>I always get a NULL dataSource, and I&#39;m stuck. <br><br>I&#39;m sure that OGR is capable to connect to PGSQL, because I tried the tool &quot;ogr2ogr&quot; and it connects to PG and manipulate GIS data with a simple connection string like: <font size="2">PG:&quot;dbname=&#39;databasename&#39; host=&#39;addr&#39; port=&#39;5432&#39; user=&#39;x&#39; passwd=&#39;y&#39;&quot;.<br>
<br><br>Any hint? <br><br>Thanks in advance,<br>Flavio<br></font>