A testing tool for Issue #60634: mysql-connector-j 9.5.0+ returns empty query results when connecting to Apache Doris.
| Key Info | Details |
|---|---|
| Trigger | useServerPrepStmts=true + mysql-connector-j ≥ 9.5.0 |
| Symptom | Queries return empty result sets, but the table actually contains data |
| Workaround | useServerPrepStmts=false&cacheResultSetMetadata=true |
| Affected Versions | Doris 3.1.4 and 4.0.2 are both affected |
- Java 17+
- Maven 3.x
- An accessible Apache Doris cluster
Edit src/main/resources/connection.properties:
doris.host=127.0.0.1
doris.port=9030
doris.database=jdbc_version_test
doris.user=root
doris.password=# Build with a specific driver version profile
./build.sh v9.5.0
# Run tests
./run.sh./run-all.shThis builds and tests all 6 driver versions (8.0.33 ~ 9.6.0) in sequence and outputs a comparison table.
| Profile | Version |
|---|---|
v8.0.33 |
8.0.33 |
v9.1.0 |
9.1.0 |
v9.2.0 |
9.2.0 |
v9.4.0 |
9.4.0 |
v9.5.0 |
9.5.0 |
v9.6.0 |
9.6.0 |
Each version is tested with 4 parameter combinations:
- Default — No extra URL parameters
useServerPrepStmts=true— Explicitly enable server-side prepared statements (triggers the bug)useServerPrepStmts=false— Disable server-side prepared statementsuseServerPrepStmts=false&cacheResultSetMetadata=true— Recommended workaround from issue discussion
Statement—SELECT *Statement—SELECT ... WHEREPreparedStatement—SELECT *(core scenario)PreparedStatement—SELECT ... WHERE id = ?(core scenario)PreparedStatement—SELECT ... WHERE username = ?- Aggregate query —
COUNT(*) SHOW DATABASESSHOW TABLESResultSetmetadata inspection
╔══════════════════════════════════════════════════════════════════════╗
║ COMPARISON SUMMARY ║
╠══════════════╦════════════════╦══════════╦══════════════════════════╣
║ Version ║ Status ║ Passed ║ Failed ║
╠══════════════╬════════════════╬══════════╬══════════════════════════╣
║ v8.0.33 ║ ✅ ALL PASS ║ 36 ║ 0 ║
║ v9.1.0 ║ ✅ ALL PASS ║ 36 ║ 0 ║
║ v9.4.0 ║ ✅ ALL PASS ║ 36 ║ 0 ║
║ v9.5.0 ║ ❌ FAILURES ║ 27 ║ 9 ║
║ v9.6.0 ║ ❌ FAILURES ║ 27 ║ 9 ║
╚══════════════╩════════════════╩══════════╩══════════════════════════╝
For each failed test case, detailed reproduction steps are printed, including:
- JDBC URL, parameters, SQL statement, and bind parameters
- Copy-pasteable Java code to reproduce the issue
jdbc-version-test/
├── pom.xml # Maven profiles to switch driver versions
├── build.sh # Build script
├── run.sh # Run script
├── run-all.sh # Batch test all versions
├── README.md # Documentation (Chinese)
├── README_EN.md # Documentation (English)
├── .gitignore
└── src/main/
├── java/com/doris/versiontest/
│ └── JdbcVersionTest.java
└── resources/
└── connection.properties