Re: Piping CSV data to psql when executing COPY .. FROM STDIN (Solved)

Поиск
Список
Период
Сортировка
От Roberts, Jon
Тема Re: Piping CSV data to psql when executing COPY .. FROM STDIN (Solved)
Дата
Msg-id 1A6E6D554222284AB25ABE3229A9276201A19DA6@nrtexcus702.int.asurion.com
обсуждение исходный текст
Ответ на Re: Piping CSV data to psql when executing COPY .. FROM STDIN (Solved)  (Allan Kamau <allank@sanbi.ac.za>)
Список pgsql-general
> I am however unable to do the same successfully (the Java code simply
> hangs, probably as a result of the second psql not getting the input
to
> it) from Java code using objects of ProcessBuilder and Process. I have
> used threads consume the STDOUT and STDERR streams (I write the STDOUT
> stream to file) do the waitFor(), then I read the file contents and
> write them to STDIN stream of the second call to psql.


> I have therefore resorted to password-less ssh. So far all is well. Am
> writing to CSV file which I scp to the remote server then I issue
> another call to psql to connect to the remote server's PostgreSQL and
> execute an sql having a COPY abc FROM ..

Why aren't you using \COPY from psql rather than COPY?  With \COPY, you
can execute the commands from your remote client without having to do
the SSH stuff.  It may run a bit longer but it is easier to maintain and
looks to be more secure.



Jon

В списке pgsql-general по дате отправления:

Предыдущее
От: "Igor Neyman"
Дата:
Сообщение: excluding tables from VACUUM ANALYZE
Следующее
От: Thomas Guettler
Дата:
Сообщение: Re: Schema Upgrade Howto