Skip to content

Commit ad5ceaa

Browse files
committed
PLUGIN-1374: Update mySql plugin so that rewriteBatchedStatements is set to true
Setting rewriteBatchedStatements to be true by default using MysqlConnectorConfig
1 parent d97ba59 commit ad5ceaa

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

mysql-plugin/src/main/java/io/cdap/plugin/mysql/MysqlConnectorConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class MysqlConnectorConfig extends AbstractDBSpecificConnectorConfig {
2828
private static final String MYSQL_CONNECTION_STRING_FORMAT = "jdbc:mysql://%s:%s";
2929
private static final String JDBC_PROPERTY_CONNECT_TIMEOUT = "connectTimeout";
3030
private static final String JDBC_PROPERTY_SOCKET_TIMEOUT = "socketTimeout";
31+
private static final String JDBC_REWRITE_BATCHED_STATEMENTS = "rewriteBatchedStatements";
3132

3233
public MysqlConnectorConfig(String host, int port, String user, String password, String jdbcPluginName,
3334
String connectionArguments) {
@@ -56,6 +57,7 @@ public Properties getConnectionArgumentsProperties() {
5657
// the unit below is milli-second
5758
prop.put(JDBC_PROPERTY_CONNECT_TIMEOUT, "20000");
5859
prop.put(JDBC_PROPERTY_SOCKET_TIMEOUT, "20000");
60+
prop.put(JDBC_REWRITE_BATCHED_STATEMENTS, "true");
5961
return prop;
6062
}
6163
}

mysql-plugin/src/test/java/io/cdap/plugin/mysql/MysqlFailedConnectionTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public void test() throws ClassNotFoundException, IOException {
3232

3333
super.test(JDBC_DRIVER_CLASS_NAME, connector, "Failed to create connection to database via connection string: " +
3434
"jdbc:mysql://localhost:3306 and arguments: {user=username, " +
35+
"rewriteBatchedStatements=true, " +
3536
"connectTimeout=20000, socketTimeout=20000}. Error: " +
3637
"ConnectException: Connection refused (Connection refused).");
3738
}

0 commit comments

Comments
 (0)