in src/main/java/com/datacompare/service/CompareService.java [832:895]
private CompareResult compareBasicData(AppProperties appProperties, Connection sourceConn, Connection targetConn,
String schemaName, String tableName) {
String sourceDBType = appProperties.getSourceDBType().toUpperCase();
CompareResult result = new CompareResult();
long start = System.currentTimeMillis();
StringBuilder info = new StringBuilder();
// Get the Java runtime
// Runtime runtime = Runtime.getRuntime();
long usedMemory = 0;
try {
checkIfTableExistsInPg(schemaName.toLowerCase(), tableName.toLowerCase(), "POSTGRESQL", targetConn);
FetchMetadata fetchSourceMetadata = new FetchMetadata(sourceDBType, null, sourceConn,
schemaName.toUpperCase(), tableName.toUpperCase(), 0, null, null, false, null, null, appProperties);
FetchMetadata fetchTargetMetadata = new FetchMetadata("POSTGRESQL", null, targetConn,
schemaName.toLowerCase(), tableName.toLowerCase(), 0, null, null, false, null, null, appProperties);
info = new StringBuilder();
info.append("\n----------------------------------------------------\n");
info.append("Finished fetching basic the data for ");
info.append(schemaName);
info.append(".");
info.append(tableName);
logger.info(info.toString());
long sourceTotalRowCount = fetchSourceMetadata.getRowCount();
result.setRowCountSource(sourceTotalRowCount);
long targetTotalRowCount = fetchTargetMetadata.getRowCount();
result.setRowCountTarget(targetTotalRowCount);
result.setTableName(tableName);
result.setResult("Completed");
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
if (result.getReason() == null) {
result.setReason(ex.getMessage());
}
result.setTableName(tableName);
result.setResult("Failed");
}
long end = System.currentTimeMillis();
long timeTaken = end - start;
result.setTimeTaken(timeTaken/1000 );
result.setUsedMemory(usedMemory);
return result;
}