Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group