Skip to content

Commit 80a3343

Browse files
authored
Merge pull request #110 from hiroyuki-sato/mysql_jdbc_version
[WIP] Output a version of MySQL Connector/J.
2 parents 6f84939 + b3d85bf commit 80a3343

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

embulk-input-jdbc/src/main/java/org/embulk/input/jdbc/AbstractJdbcInputPlugin.java

+2
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ public ConfigDiff transaction(ConfigSource config,
184184

185185
Schema schema;
186186
try (JdbcInputConnection con = newConnection(task)) {
187+
con.showDriverVersion();
188+
187189
// TODO incremental_columns is not set => get primary key
188190
schema = setupTask(con, task);
189191
} catch (SQLException ex) {

embulk-input-jdbc/src/main/java/org/embulk/input/jdbc/JdbcInputConnection.java

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.sql.ResultSetMetaData;
88
import java.sql.SQLException;
99
import java.sql.Statement;
10+
import java.util.Locale;
1011
import java.util.Set;
1112

1213
import org.embulk.config.ConfigException;
@@ -386,4 +387,9 @@ private Set<String> getColumnNames(String tableName) throws SQLException
386387
return columnNamesBuilder.build();
387388
}
388389
}
390+
391+
public void showDriverVersion() throws SQLException {
392+
DatabaseMetaData meta = connection.getMetaData();
393+
logger.info(String.format(Locale.ENGLISH,"Using JDBC Driver %s",meta.getDriverVersion()));
394+
}
389395
}

embulk-input-mysql/src/main/java/org/embulk/input/mysql/MySQLInputConnection.java

+15
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,19 @@ public void compareTimeZone() throws SQLException
6767
timeZoneComparison.compareTimeZone();
6868
}
6969

70+
//
71+
//
72+
// The MySQL Connector/J 5.1.35 introduce new option `Current MySQL Connect`.
73+
// It has incompatibility behavior current version and 5.1.35.
74+
//
75+
// This method announces users about this change before the update driver version.
76+
//
77+
@Override
78+
public void showDriverVersion() throws SQLException {
79+
super.showDriverVersion();
80+
logger.warn("This plugin will update MySQL Connector/J version in the near future release.");
81+
logger.warn("It has some incompatibility changes.");
82+
logger.warn("For example, the 5.1.35 introduced `noTimezoneConversionForDateType` and `cacheDefaultTimezone` options.");
83+
logger.warn("Please read a document and make sure configuration carefully before updating the plugin.");
84+
}
7085
}

0 commit comments

Comments
 (0)