#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    2
    Rep Power
    0

    remote text file data copy using JBDC


    Hi,

    I hav text files which i have generated by paring the XML files using the XALAN processor. Now, i want to copy the data in the text file in the database which is on some remote machine. i m using JAVA (JDBC) on the client side. My text file is in the format which is required by the postgresql COPY command(with delimiters). Instead of calling multiple INSERT commands from the client application, i want to somehow send the file(stream or anything) to the database and use the COPY command. Does anyone knows how to get over this problem?

    thanks for all ur replies in advance.

    Ketan.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    373
    Rep Power
    12
    RU going to have to do this over and over frequently, or more like a batch job? (will it create consistent network traffic?) I am just confused about your approach-- if you parse the XML into INSERT statements for a schema that already exists then you will just run the insert statements. You could run a whole file of INSERTs or COPYs with psql, just run a local script from the java or I am not sure if you can do exec() from a java program but just run the SQL from the file with a psql command.

    I've found some stuff in the manual about the COPY command, here .

    That's for 7.3, shouldn't be that much different though.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    2
    Rep Power
    0
    thank u so much for ur reply .

IMN logo majestic logo threadwatch logo seochat tools logo