export CSV file through Java JDBC

Поиск
Список
Период
Сортировка
От Emi Lu
Тема export CSV file through Java JDBC
Дата
Msg-id 48035F15.4030302@encs.concordia.ca
обсуждение исходный текст
Список pgsql-sql
Good morning,

Running the following command from command line is ok, but cannot export 
a table into a csv file through java JDBC code.

Please help!


JAVA code:
===================   public static void exec(String command)   {      try{         Process p   =
Runtime.getRuntime().exec(command);        p.waitFor();         p.destroy();      }catch(Exception e) {
System.err.println("execcommand Error:  " + e.getMessage());      }   }
 



SQL Command:
=================
psql -U username -d dbName -c  "\copy tableName to 'result.csv'  with CSV "

When call exec(commands);

Nothing happens, result.csv was not created at all?

Thanks a lot!




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

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: Get the last inserted id
Следующее
От: "Chad Showalter"
Дата:
Сообщение: rule for update view that updates/inserts into 2 tables