Re: shp2pgsql in java

From: Michael Wood <esiotrot(at)gmail(dot)com>
To: Melanie Hofmann <melanie(dot)hofmann20(at)googlemail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: shp2pgsql in java
Date: 2009-09-18 06:55:00
Message-ID: 5a8aa6680909172355t4b1899c7yc9fd88fdd835e49@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

2009/9/18 Melanie Hofmann <melanie(dot)hofmann20(at)googlemail(dot)com>:
> Hello,
>
> I am new in this list.
> Sorry for my worse english.
>
> I have a problem, and I didn't find a answer in the Internet.
>
> I will use the command shp2pgsql from a java programm to import shapefiles
> in a postgresql DB, but I can't find some examples.
>
> Can anybody help me, or have anybody an example how this work? or a
> documentation?
>
> Thank you for your answer.

I think you basically want to set up a shell pipeline from Java.

You could either execute shp2pgsql from Java and arrange for its
stdout file descriptor to be pointing at a file and then execute psql
to read from that same file, or you could do it in one step by
connecting the stdout of shp2pgsql to the stdin of psql.

From Python, this is one way to do it. (It should work from Jython
too, I think):
http://docs.python.org/library/subprocess.html#replacing-shell-pipeline

From Java you might find something useful here:
http://www.google.co.za/search?q=java+execute+shell+command

--
Michael Wood <esiotrot(at)gmail(dot)com>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Ron Arts 2009-09-18 10:06:47 Index not used in join.. (example included)
Previous Message Michael Wood 2009-09-18 06:37:23 Re: Problem of creating geometry column (linestring)