Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > ex****t CSV fil...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 3406 of 3559
Post > Topic >>

ex****t CSV file through Java JDBC

by emilu@[EMAIL PROTECTED] (Emi Lu) Apr 14, 2008 at 09:41 AM

Good morning,

Running the following command from command line is ok, but cannot ex****t 
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@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
 




 1 Posts in Topic:
ex****t CSV file through Java JDBC
emilu@[EMAIL PROTECTED]   2008-04-14 09:41:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 6 15:57:33 CDT 2008.