Updated Branches: refs/heads/trunk d3758915b -> c913f77f2
SQOOP-1279. Sqoop connection resiliency option breaks older Mysql versions that don't have JDBC 4 methods (Venkat Ranganathan via Hari Shreedharan) Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/c913f77f Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/c913f77f Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/c913f77f Branch: refs/heads/trunk Commit: c913f77f284cb27ce5aa43fd433b59a52d3032b3 Parents: d375891 Author: Hari Shreedharan <[email protected]> Authored: Mon Feb 3 16:08:47 2014 -0800 Committer: Hari Shreedharan <[email protected]> Committed: Mon Feb 3 16:08:47 2014 -0800 ---------------------------------------------------------------------- .../org/apache/sqoop/mapreduce/db/DBRecordReader.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sqoop/blob/c913f77f/src/java/org/apache/sqoop/mapreduce/db/DBRecordReader.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/sqoop/mapreduce/db/DBRecordReader.java b/src/java/org/apache/sqoop/mapreduce/db/DBRecordReader.java index e33e427..a78eb06 100644 --- a/src/java/org/apache/sqoop/mapreduce/db/DBRecordReader.java +++ b/src/java/org/apache/sqoop/mapreduce/db/DBRecordReader.java @@ -154,13 +154,15 @@ public class DBRecordReader<T extends DBWritable> extends } @Override - /** {@inheritDoc} */ public void close() throws IOException { try { if (null != results) { results.close(); } - if (null != statement && !statement.isClosed()) { + // Statement.isClosed() is only available from JDBC 4 + // Some older drivers (like mysql 5.0.x and earlier fail with + // the check for statement.isClosed() + if (null != statement) { statement.close(); } if (null != connection && !connection.isClosed()) { @@ -178,13 +180,11 @@ public class DBRecordReader<T extends DBWritable> extends } @Override - /** {@inheritDoc} */ public LongWritable getCurrentKey() { return key; } @Override - /** {@inheritDoc} */ public T getCurrentValue() { return value; } @@ -216,13 +216,11 @@ public class DBRecordReader<T extends DBWritable> extends } @Override - /** {@inheritDoc} */ public float getProgress() throws IOException { return pos / (float)split.getLength(); } @Override - /** {@inheritDoc} */ public boolean nextKeyValue() throws IOException { try { if (key == null) {
