November 1st, 2003, 09:28 PM
remote text file data copy using JBDC
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.
November 2nd, 2003, 12:28 PM
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.
November 2nd, 2003, 04:42 PM
thank u so much for ur reply .