5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-08 07:11:01 +08:00

SQOOP-1476: Generic JDBC Connector - DB connections not closed

(Claire Fautsch via Jarek Jarcec Cecho)
This commit is contained in:
Jarek Jarcec Cecho 2014-09-01 15:27:18 +02:00 committed by Abraham Elmahrek
parent 51a07bc352
commit 8fee134f7f
2 changed files with 14 additions and 8 deletions

View File

@ -111,6 +111,9 @@ public Schema getSchema(InitializerContext context, ConnectionConfiguration conn
LOG.info("Ignoring exception while closing ResultSet", e);
}
}
if (executor != null) {
executor.close();
}
}
}

View File

@ -48,14 +48,17 @@ private void moveDataToDestinationTable(ConnectionConfiguration connectorConf,
connectorConf.connection.connectionString,
connectorConf.connection.username,
connectorConf.connection.password);
if(success) {
LOG.info("Job completed, transferring data from stage fromTable to " +
"destination fromTable.");
executor.migrateData(stageTableName, tableName);
} else {
LOG.warn("Job failed, clearing stage fromTable.");
executor.deleteTableData(stageTableName);
try {
if(success) {
LOG.info("Job completed, transferring data from stage fromTable to " +
"destination fromTable.");
executor.migrateData(stageTableName, tableName);
} else {
LOG.warn("Job failed, clearing stage fromTable.");
executor.deleteTableData(stageTableName);
}
} finally {
executor.close();
}
}