From: | Emi Lu <emilu(at)encs(dot)concordia(dot)ca> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | export CSV file through Java JDBC |
Date: | 2008-04-14 13:41:41 |
Message-ID: | 48035F15.4030302@encs.concordia.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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("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!
From | Date | Subject | |
---|---|---|---|
Next Message | Chad Showalter | 2008-04-14 16:47:30 | rule for update view that updates/inserts into 2 tables |
Previous Message | Andrew Sullivan | 2008-04-11 17:57:44 | Re: Get the last inserted id |