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:
parent
51a07bc352
commit
8fee134f7f
@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user