Skip to content
Permalink
Browse files

[CONJ-642] disable the option "useBulkStmts" by default

(cherry picked from commit fc92233)
  • Loading branch information...
rusher committed Sep 3, 2018
1 parent f82b703 commit 0b94b9060c39006b506b6d4ad545f3a7bdffb9de
@@ -52,10 +52,9 @@

package org.mariadb.jdbc.internal.util;

import org.mariadb.jdbc.internal.util.constant.HaMode;

import java.lang.reflect.Field;
import java.util.Properties;
import org.mariadb.jdbc.internal.util.constant.HaMode;

public enum DefaultOptions {

@@ -243,7 +242,7 @@
+ "alternative names or the certificate CN) to prevent man-in-the-middle attacks. This option permits "
+ "deactivating this validation. Hostname verification is disabled when the trustServerCertificate "
+ "option is set", false),
USE_BULK_PROTOCOL("useBulkStmts", Boolean.TRUE, "1.6.0", "Use dedicated COM_STMT_BULK_EXECUTE protocol for batch "
USE_BULK_PROTOCOL("useBulkStmts", Boolean.FALSE, "1.6.0", "Use dedicated COM_STMT_BULK_EXECUTE protocol for batch "
+ "insert when possible. (batch without Statement.RETURN_GENERATED_KEYS and streams) to have faster batch. "
+ "(significant only if server MariaDB >= 10.2.7)", false),
AUTOCOMMIT("autocommit", Boolean.TRUE, "1.7.0", "Set default autocommit value on connection initialization", false),
@@ -119,7 +119,7 @@
public int useBatchMultiSendNumber = 100;
public Boolean usePipelineAuth;
public boolean enablePacketDebug;
public boolean useBulkStmts = true;
public boolean useBulkStmts;
public boolean disableSslHostnameVerification;
public boolean autocommit = true;

@@ -52,18 +52,19 @@

package org.mariadb.jdbc;

import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mariadb.jdbc.internal.protocol.Protocol;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;

import static org.junit.Assert.*;
import javax.sql.DataSource;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mariadb.jdbc.internal.protocol.Protocol;

public class ErrorMessageTest extends BaseTest {

@@ -99,7 +100,7 @@ public void testSmallMultiBatchErrorMessage() throws SQLException {
executeBatchWithException(connection);
fail("Must Have thrown error");
} catch (SQLException sqle) {
if (isMariadbServer() && minVersion(10,2)) {
if (isMariadbServer() && minVersion(10,2) && sharedOptions().useBulkStmts) {
assertTrue("message : " + sqle.getCause().getCause().getMessage(),
sqle.getCause().getCause().getMessage().contains(
"INSERT INTO testErrorMessage(test, test2) values (?, ?)"));
@@ -144,7 +145,7 @@ public void testSmallBulkErrorMessage() throws SQLException {
executeBatchWithException(connection);
fail("Must Have thrown error");
} catch (SQLException sqle) {
if (isMariadbServer() && minVersion(10,2)) {
if (isMariadbServer() && minVersion(10,2) && sharedOptions().useBulkStmts) {
assertTrue("message : " + sqle.getCause().getCause().getMessage(),
sqle.getCause().getCause().getMessage().contains(
"INSERT INTO testErrorMessage(test, test2) values (?, ?)"));
@@ -198,7 +199,7 @@ public void testBigMultiErrorMessage() throws SQLException {
executeBigBatchWithException(connection);
fail("Must Have thrown error");
} catch (SQLException sqle) {
if (isMariadbServer() && minVersion(10,2)) {
if (isMariadbServer() && minVersion(10,2) && sharedOptions().useBulkStmts) {
assertTrue("message : " + sqle.getCause().getCause().getMessage(),
sqle.getCause().getCause().getMessage().contains(
"INSERT INTO testErrorMessage(test, test2) values (?, ?)"));
@@ -253,7 +254,7 @@ public void testBigBulkErrorMessage() throws SQLException {
executeBigBatchWithException(connection);
fail("Must Have thrown error");
} catch (SQLException sqle) {
if (isMariadbServer() && minVersion(10,2)) {
if (isMariadbServer() && minVersion(10,2) && sharedOptions().useBulkStmts) {
assertTrue("message : " + sqle.getCause().getCause().getMessage(),
sqle.getCause().getCause().getMessage().contains(
"INSERT INTO testErrorMessage(test, test2) values (?, ?)"));

0 comments on commit 0b94b90

Please sign in to comment.
You can’t perform that action at this time.