5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-11 06:20:43 +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); 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.connectionString,
connectorConf.connection.username, connectorConf.connection.username,
connectorConf.connection.password); connectorConf.connection.password);
try {
if(success) { if(success) {
LOG.info("Job completed, transferring data from stage fromTable to " + LOG.info("Job completed, transferring data from stage fromTable to " +
"destination fromTable."); "destination fromTable.");
executor.migrateData(stageTableName, tableName); executor.migrateData(stageTableName, tableName);
} else { } else {
LOG.warn("Job failed, clearing stage fromTable."); LOG.warn("Job failed, clearing stage fromTable.");
executor.deleteTableData(stageTableName); executor.deleteTableData(stageTableName);
}
} finally {
executor.close();
} }
} }