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!