-
Notifications
You must be signed in to change notification settings - Fork 74
Output a version of MySQL Connector/J. #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thank you for the PR!
How to implement it. We can get driver information by
We should output a result of
I think we should do in And it must be useful if driver version is shown in not also embulk-output-mysql but also all embulk-output-jdbc plugins. |
This reverts commit d0ebcd1.
Use java.sql.Connection#getMetaData() method to output JDBC driver version.
@hito4t Thank you for your comment. I used I'll change later the following part |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Please check comments.
try { | ||
DatabaseMetaData meta = connection.getMetaData(); | ||
logger.info(String.format(Locale.ENGLISH,"Using JDBC Driver %s",meta.getDriverVersion())); | ||
} catch( SQLException e ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need to catch SQLException because Connection#getMetaData#getDriverVersion doesn't throw an exception normally.
If thrown, we can't access database after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throw the exception instead of catch
.
@@ -185,6 +185,7 @@ public ConfigDiff transaction(ConfigSource config, | |||
Schema schema; | |||
try (JdbcInputConnection con = newConnection(task)) { | |||
// TODO incremental_columns is not set => get primary key | |||
con.showDriverVersion(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment above (// TODO incremental_columns ...
) should be above the following line (schema = setupTask(con, task);
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move comment to propper place.
@hito4t Thank you for reviewing. Please take a look again. It output the message like the below.
|
Thank you!
|
@hito4t
|
@hiroyuki-sato |
Thank you for your comment!. I fixed some errors.
|
Thank you! |
I'd like to resolve #113 before upgrading MySQL Connector/J. |
Overview
I would like to update MySQL Connector/J to a newer version. (5.1.42 or newer)
But It has incompatibility change.
We(I and @hito4t) decided that the plugin output a warning message like
This plugin will update Connector/J on next release...
This PR for implement this warning.
Detail
@hito4t, Could you give me some advice?
When output a version information and warning?
I think I should the message should output before
Loaded plugin embulk/input/mysql from a load path
.Example.
How to output current Connector/J version?
I would like to output warning message with current MySQL Connector/J version.
So I tried to get it.
The current experimental implementation get version info from
Package
object.First I tried to get the version info from
Driver
class.But It can't get sub minor version (z part in x.y.z).
That's why I used this way.
Do you have any alternative idea?