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