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("exec command 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!



--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to