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

SQOOP-1279. Sqoop connection resiliency option breaks older Mysql versions that don't have JDBC 4 methods

(Venkat Ranganathan via Hari Shreedharan)
This commit is contained in:
Hari Shreedharan 2014-02-03 16:08:47 -08:00
parent d3758915bb
commit c913f77f28

View File

@ -154,13 +154,15 @@ protected String getSelectQuery() {
}
@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 void initialize(InputSplit inputSplit, TaskAttemptContext context)
}
@Override
/** {@inheritDoc} */
public LongWritable getCurrentKey() {
return key;
}
@Override
/** {@inheritDoc} */
public T getCurrentValue() {
return value;
}
@ -216,13 +216,11 @@ public boolean next(LongWritable k, T v) throws IOException {
}
@Override
/** {@inheritDoc} */
public float getProgress() throws IOException {
return pos / (float)split.getLength();
}
@Override
/** {@inheritDoc} */
public boolean nextKeyValue() throws IOException {
try {
if (key == null) {