<div dir="ltr"><div><div>Hi James,<br><br></div>Thank you for your reply.<br></div>With your suggest I've tested using quotes but also doesn't work.<br>About de columns, it's right, they are there.<br>I've tested the same query direct on terminal.<br>
The solution I'm usin is create another script to encapsulate pgsql2shp ( like mypgsql2shp.sh ) where I can pass the parameters without problems.<br><br>Any way thank you for your attention.<br><br>Best regards<br></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Apr 5, 2013 at 6:24 AM, James David Smith <span dir="ltr"><<a href="mailto:james.david.smith@gmail.com" target="_blank">james.david.smith@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sorry for the dumb suggestions, but have you tried putting '37995'<br>
instead of 37995 ? Also you are absolutely sure that you have columns<br>
called coordinates and date in your points table right? Note that they<br>
might be case sensitive too, so check that.<br>
<br>
On 4 April 2013 16:21, Lelo - Luiz Rogério De Pieri<br>
<div><div class="h5"><<a href="mailto:lelo.pieri@gmail.com">lelo.pieri@gmail.com</a>> wrote:<br>
> Hi all,<br>
><br>
> I'm having a problem to execute a pgsql2shp command using java.<br>
><br>
> My OS is Ubuntu and it's frequently I use to generate shp files using<br>
> pgsql2shp, but now I want to do it through java.<br>
><br>
> The follow command works fine on terminal<br>
> pgsql2shp -f pontos_05600202_teste -h myhost -u myuser -P mypasswd -g<br>
> coordinates my_database "SELECT * from points where id_uploaded_file =<br>
> 37995";<br>
><br>
> Now I'm trying to execute the follow code:<br>
><br>
> ProcessBuilder pb = new ProcessBuilder("pgsql2shp", "-f<br>
> pontos_05600202_teste", "-h myhost", "-u myuser", "-P mypasswd", "-g<br>
> coordinates", "my_database", "SELECT coordinates, date from points where<br>
> id_uploaded_file = 37995");<br>
><br>
> Process proc;<br>
> proc = pb.start();<br>
> InputStream stdin = proc.getInputStream();<br>
> InputStreamReader isr = new InputStreamReader(stdin);<br>
> BufferedReader br = new BufferedReader(isr);<br>
><br>
> String line = null;<br>
> System.out.println("<OUTPUT>");<br>
><br>
> while ((line = br.readLine()) != null)<br>
> System.out.println(line);<br>
><br>
> System.out.println("</OUTPUT>");<br>
> int exitVal = proc.waitFor();<br>
> System.out.println("Process exitValue: " + exitVal);<br>
><br>
><br>
> And the result is:<br>
><br>
> <OUTPUT><br>
> Preparing table for user query... Done.<br>
> Initializing... coordinates: no such attribute in table<br>
> __pgsql2shp14493_tmp_table<br>
> </OUTPUT><br>
><br>
> Does anybody as any idea about it?<br>
><br>
> Thank you for all<br>
><br>
> Best regards<br>
> --<br>
> Rogério De Pieri (Lelo)<br>
> SCJP 5<br>
> Buscando melhorar a cada dia<br>
> Áudio, Hardware & Software<br>
> <a href="http://www.twitter.com/lelopieri" target="_blank">www.twitter.com/lelopieri</a><br>
> <a href="http://blogdolelo.wordpress.com" target="_blank">blogdolelo.wordpress.com</a><br>
><br>
</div></div>> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
><br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Rogério De Pieri (Lelo)<div>SCJP 5<br><div><div>Buscando melhorar a cada dia<br>Áudio, Hardware & Software</div></div><div><a href="http://www.twitter.com/lelopieri" target="_blank">www.twitter.com/lelopieri</a></div>
<div><a href="http://blogdolelo.wordpress.com" target="_blank">blogdolelo.wordpress.com</a></div></div>
</div>