Bug #118167 A potential bugs in Mysql Connector/J
Description:
/*
* There's a MYSQL bug here, where setting allowMultiQueries to false results in -3 1
* but when allowMultiQueries is set to true, the result is -1 -3.
* This is confusing.
* Theoretically, allowMultiQueries=true or false should only affect whether or not multiple queries can be executed in the same Statement when executing a batch, and should not affect the results of individual queries.
* If the two result in significantly different behavior for batch results, this could indeed be a design issue or implementation bug in the JDBC driver.
* */
How to repeat:
public static void main(String[] args) throws SQLException
{
/*
* There's a MYSQL bug here, where setting allowMultiQueries to false results in -3 1
* but when allowMultiQueries is set to true, the result is -1 -3.
* This is confusing.
* Theoretically, allowMultiQueries=true or false should only affect whether or not multiple queries can be executed in the same Statement when executing a batch, and should not affect the results of individual queries.
* If the two result in significantly different behavior for batch results, this could indeed be a design issue or implementation bug in the JDBC driver.
* */
String url1 = "jdbc:mysql://localhost:3306/test?user=root&password=1234&allowMultiQueries=true";
String url2 = "jdbc:oceanbase://49.52.27.61:2881/test?user=root@test&password=1234&allowMultiQueries=true";
Connection con = DriverManager.getConnection(url1);
Statement stmt = con.createStatement();
stmt.execute("DROP TABLE IF EXISTS t0");
stmt.execute("CREATE TABLE t0(c0 INT PRIMARY KEY NOT NULL)");
stmt.execute("INSERT INTO t0 VALUES (267492252)");
Statement bstmt = con.createStatement();
bstmt.addBatch("INSERT INTO t0 VALUES (267492252)");
bstmt.addBatch("INSERT INTO t0 VALUES (622)");
try {
bstmt.executeBatch();
} catch (BatchUpdateException e) {
int[] res = e.getUpdateCounts();
for (int r : res) {
System.out.println(r);
}
}
}
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.052 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: /* * There's a MYSQL bug here, where setting allowMultiQueries to false results in -3 1 * but when allowMultiQueries is set to true, the result is -1 -3. * This is confusing. * Theoretically, allowMultiQueries=true or false should only affect whether or not multiple queries can be executed in the same Statement when executing a batch, and should not affect the results of individual queries. * If the two result in significantly different behavior for batch results, this could indeed be a design issue or implementation bug in the JDBC driver. * */ How to repeat: public static void main(String[] args) throws SQLException { /* * There's a MYSQL bug here, where setting allowMultiQueries to false results in -3 1 * but when allowMultiQueries is set to true, the result is -1 -3. * This is confusing. * Theoretically, allowMultiQueries=true or false should only affect whether or not multiple queries can be executed in the same Statement when executing a batch, and should not affect the results of individual queries. * If the two result in significantly different behavior for batch results, this could indeed be a design issue or implementation bug in the JDBC driver. * */ String url1 = "jdbc:mysql://localhost:3306/test?user=root&password=1234&allowMultiQueries=true"; String url2 = "jdbc:oceanbase://49.52.27.61:2881/test?user=root@test&password=1234&allowMultiQueries=true"; Connection con = DriverManager.getConnection(url1); Statement stmt = con.createStatement(); stmt.execute("DROP TABLE IF EXISTS t0"); stmt.execute("CREATE TABLE t0(c0 INT PRIMARY KEY NOT NULL)"); stmt.execute("INSERT INTO t0 VALUES (267492252)"); Statement bstmt = con.createStatement(); bstmt.addBatch("INSERT INTO t0 VALUES (267492252)"); bstmt.addBatch("INSERT INTO t0 VALUES (622)"); try { bstmt.executeBatch(); } catch (BatchUpdateException e) { int[] res = e.getUpdateCounts(); for (int r : res) { System.out.println(r); } } }