diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/AbstractJdbcOutputPlugin.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/AbstractJdbcOutputPlugin.java index 9f2c1cb9..d80408bd 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/AbstractJdbcOutputPlugin.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/AbstractJdbcOutputPlugin.java @@ -583,7 +583,7 @@ protected void doBegin(JdbcOutputConnection con, } } } - task.setActualTable(new TableIdentifier(null, con.getSchemaName(), actualTable)); + task.setActualTable(new TableIdentifier(con.getDatabaseName(), con.getSchemaName(), actualTable)); Optional initialTargetTableSchema = mode.ignoreTargetTableSchema() ? diff --git a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/JdbcOutputConnection.java b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/JdbcOutputConnection.java index 24287eca..e2f70cf1 100644 --- a/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/JdbcOutputConnection.java +++ b/embulk-output-jdbc/src/main/java/org/embulk/output/jdbc/JdbcOutputConnection.java @@ -61,6 +61,11 @@ public void close() throws SQLException } } + public String getDatabaseName() throws SQLException + { + return connection.getCatalog(); + } + public String getSchemaName() { return schemaName; diff --git a/embulk-output-mysql/src/main/java/org/embulk/output/MySQLOutputPlugin.java b/embulk-output-mysql/src/main/java/org/embulk/output/MySQLOutputPlugin.java index ea90aace..1ea4dcfb 100644 --- a/embulk-output-mysql/src/main/java/org/embulk/output/MySQLOutputPlugin.java +++ b/embulk-output-mysql/src/main/java/org/embulk/output/MySQLOutputPlugin.java @@ -88,6 +88,8 @@ protected JdbcOutputConnector getConnector(PluginTask task, boolean retryableMet props.setProperty("connectTimeout", "300000"); // milliseconds props.setProperty("socketTimeout", "1800000"); // smillieconds + props.setProperty("nullCatalogMeansCurrent", "false"); + // Enable keepalive based on tcp_keepalive_time, tcp_keepalive_intvl and tcp_keepalive_probes kernel parameters. // Socket options TCP_KEEPCNT, TCP_KEEPIDLE, and TCP_KEEPINTVL are not configurable. props.setProperty("tcpKeepAlive", "true");