Retrieve rejected records after COPY command
Posted: Tue May 29, 2012 1:33 pm
Hi,
I implements a java loader component and use COPY statement in order to load the data into Vertica.
This is a snippet of my java code :
....
Connection connection = DriverManager.getConnection(connectionUrl, username, password);
try {
String sql = "COPY public.TEST_LOAD_TABLE (A, B, DATADATE FORMAT 'YYYYMMDDHH24MISS', N) FROM STDIN DELIMITER '|' TRAILING NULLCOLS DIRECT NO COMMIT;"
FileInputStream file = new FileInputStream(workingFile);
connection.setAutoCommit(false);
PGStatement stmt = (PGStatement) connection.createStatement();
stmt.executeCopyIn(sql, file);
} catch (Exception ex) {
connection.rollback();
throw ex;
}
connection.commit();
........
During the copy statement I have some reject records, but I need to know which records has been rejected in order to edit e reload these ones.
Does exist a way to retrieve the rejected records?
I implements a java loader component and use COPY statement in order to load the data into Vertica.
This is a snippet of my java code :
....
Connection connection = DriverManager.getConnection(connectionUrl, username, password);
try {
String sql = "COPY public.TEST_LOAD_TABLE (A, B, DATADATE FORMAT 'YYYYMMDDHH24MISS', N) FROM STDIN DELIMITER '|' TRAILING NULLCOLS DIRECT NO COMMIT;"
FileInputStream file = new FileInputStream(workingFile);
connection.setAutoCommit(false);
PGStatement stmt = (PGStatement) connection.createStatement();
stmt.executeCopyIn(sql, file);
} catch (Exception ex) {
connection.rollback();
throw ex;
}
connection.commit();
........
During the copy statement I have some reject records, but I need to know which records has been rejected in order to edit e reload these ones.
Does exist a way to retrieve the rejected records?