mirror of
https://github.com/apache/sqoop.git
synced 2025-05-04 02:52:19 +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:
parent
d3758915bb
commit
c913f77f28
@ -154,13 +154,15 @@ protected String getSelectQuery() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
/** {@inheritDoc} */
|
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
try {
|
try {
|
||||||
if (null != results) {
|
if (null != results) {
|
||||||
results.close();
|
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();
|
statement.close();
|
||||||
}
|
}
|
||||||
if (null != connection && !connection.isClosed()) {
|
if (null != connection && !connection.isClosed()) {
|
||||||
@ -178,13 +180,11 @@ public void initialize(InputSplit inputSplit, TaskAttemptContext context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
/** {@inheritDoc} */
|
|
||||||
public LongWritable getCurrentKey() {
|
public LongWritable getCurrentKey() {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
/** {@inheritDoc} */
|
|
||||||
public T getCurrentValue() {
|
public T getCurrentValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -216,13 +216,11 @@ public boolean next(LongWritable k, T v) throws IOException {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
/** {@inheritDoc} */
|
|
||||||
public float getProgress() throws IOException {
|
public float getProgress() throws IOException {
|
||||||
return pos / (float)split.getLength();
|
return pos / (float)split.getLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
/** {@inheritDoc} */
|
|
||||||
public boolean nextKeyValue() throws IOException {
|
public boolean nextKeyValue() throws IOException {
|
||||||
try {
|
try {
|
||||||
if (key == null) {
|
if (key == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user