<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Ensure you have appropriately modified postgreql.conf &amp; pg_hba.conf to allow the appropriate external access to the required database, for the required user, from the client IP (CIDR) address. If this is not enabled, such external connections cannot happen.<br><br>Brent Wood<br><br>--- On <b>Sat, 5/12/12, Siju Wu <i>&lt;wsj0621@gmail.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Siju Wu &lt;wsj0621@gmail.com&gt;<br>Subject: [gdal-dev] PostgreSQL driver for GDAL1.8.1<br>To: gdal-dev@lists.osgeo.org<br>Date: Saturday, May 12, 2012, 8:00 PM<br><br><div id="yiv1815523815">Hi,<div>I began using the GDAL for my master&nbsp;projet last month. Before I used&nbsp;OGR to read directly the maps of shapefile. But now I need to store the data first in the database of PostgreSQL and
 then make access to the database by using the driver of OGR.&nbsp;However I found that I can't connect the database by using the function&nbsp;OGRSFDriverRegistrar::Open( source, FALSE ). My code is as below:</div>
<div><br></div><div><div><br></div><div><span class="yiv1815523815Apple-tab-span" style="white-space:pre;">        </span>OGRRegisterAll();</div><div><span class="yiv1815523815Apple-tab-span" style="white-space:pre;">        </span></div><div><span class="yiv1815523815Apple-tab-span" style="white-space:pre;">        </span>OGRDataSource *poDS;</div>
<div><br></div><div><span class="yiv1815523815Apple-tab-span" style="white-space:pre;">        </span>poDS = OGRSFDriverRegistrar::Open( "PG:dbname='postgis' host='localhost' &nbsp; &nbsp; &nbsp; &nbsp;port='5432' user='postgres' password='postgres'", FALSE );</div>
<div><span class="yiv1815523815Apple-tab-span" style="white-space:pre;">        </span></div><div><span class="yiv1815523815Apple-tab-span" style="white-space:pre;">        </span>if( poDS == NULL )</div><div><span class="yiv1815523815Apple-tab-span" style="white-space:pre;">        </span>{</div>
<div><span class="yiv1815523815Apple-tab-span" style="white-space:pre;">                </span>printf( "Open failed.\n" );</div><div><span class="yiv1815523815Apple-tab-span" style="white-space:pre;">                </span>exit( 1 );</div><div><span class="yiv1815523815Apple-tab-span" style="white-space:pre;">        </span>}</div>
</div><div><br></div><div><br></div><div>the value of poDS is null.&nbsp;Is that means in the version of GDAL there is no driver for the postgreSQL and I need to write it myself? I work with VS2010 c++ and GDAL 1.8.1. Dose anyone know if there is method to connect the PostgreSQL by using OGR?</div>
<div><br></div><div>Thanks,</div><div>-Michel</div>
</div><br>-----Inline Attachment Follows-----<br><br><div class="plainMail">_______________________________________________<br>gdal-dev mailing list<br><a ymailto="mailto:gdal-dev@lists.osgeo.org" href="/mc/compose?to=gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></div></blockquote></td></tr></table>