<br><br><div class="gmail_quote">2009/7/7 Frank Warmerdam <span dir="ltr"><<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">Flavio Perri - QMap srl wrote:<br>
</div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello Frank,<br>
thanks for your answer.<br>
<br>
I tried looking at OGR documentation, and I found the method you wrote:<br>
<br>
OGRDataSource * OGRSFDriverRegistrar::Open ( const char * pszName, int bUpdate = FALSE, OGRSFDriver ** ppoDriver = NULL ) .<br>
<br>
I don't understand the first parameter: is it the NAME of a PSQL istance or an handle? And, in this case, should I connect using the psql library?<br>
Please can you give me a simple example?<br>
</blockquote>
<br></div>
Flavio,<br>
<br>
The pszName value is just the "PG:dbname=... ..." string you would pass on<br>
the commandline to ogr2ogr. You will want to pass bUpdate as TRUE and the<br>
last argument can be left NULL since it isn't important for you to discover<br>
what driver ended up being used.<br>
<br>
Don't hesitate to skim the ogr2ogr source code for guidance.</blockquote><div><br>Hi Frank,<br>i tried that way, but it still doesn't work!!<br><br>This is my CodeSample:<br><br>--------------<br>string connectionSTR="";<br>
<br> connectionSTR +="PG:";<br> connectionSTR +="dbname='";<br> connectionSTR += dbServerName;<br> connectionSTR += "' ";<br> connectionSTR +="host='";<br>
connectionSTR += dbHostAddress;<br> connectionSTR += "' ";<br> connectionSTR +="port='";<br> connectionSTR += port;<br> connectionSTR += "' ";<br> connectionSTR +="user='";<br>
connectionSTR += userName;<br> connectionSTR += "' ";<br> connectionSTR +="passwd='";<br> connectionSTR += password;<br> connectionSTR += "'";<br> <br> dataSource = OGRSFDriverRegistrar::Open(connectionSTR.c_str(),TRUE,NULL);<br>
<br>-----<br><br>dataSource is NULL, the generated connectionSTR is this: <br>PG:dbname='postgis' host='localhost' port='5432' user='postgres' passwd='postgres'<br><br>where is my fault?<br>
<br>Best regards,<br>Flavio<br></div></div><br>