Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(jdbc): stop forcing cursor fetching

wbean1e0687a7e246
diff --git a/plugins/jdbc/README.md b/plugins/jdbc/README.md
index e70d732e07..2178c380f9 100644
--- a/plugins/jdbc/README.md
+++ b/plugins/jdbc/README.md
@@ -36,6 +36,18 @@ lib/dbx-jdbc-plugin.jar
DBX does not bundle Java or JDBC drivers. Install Java locally and add database-specific driver JAR paths in the DBX JDBC connection form.
+## MySQL-compatible cursor fetching
+
+DBX uses standard JDBC result-set paging, but does not automatically set Connector/J's `useCursorFetch` property.
+That property enables a MySQL-specific server cursor protocol; it is not part of JDBC and may be unsupported by
+MySQL-compatible servers. If a server and driver are known to support it, opt in explicitly in the connection URL:
+
+```text
+jdbc:mysql://host:3306/database?useCursorFetch=true
+```
+
+Leave the property unset for generic JDBC or compatibility drivers that need to shield non-standard server behavior.
+
The first-class JDBCX profile uses `io.github.jdbcx.WrappedDriver` and
`jdbcx:[extension:][vendor://host:port/database]` URLs. Install a JDBCX Maven bundle such as
`io.github.jdbcx:jdbcx-driver:0.8.0` in the DBX JDBC driver store, together with the database vendor's JDBC driver.
diff --git a/plugins/jdbc/build.gradle b/plugins/jdbc/build.gradle
index 6d4aeade56..20b2a812f2 100644
--- a/plugins/jdbc/build.gradle
+++ b/plugins/jdbc/build.gradle
@@ -4,7 +4,7 @@ plugins {
}
group = 'app.dbx'
-version = '0.1.29'
+version = '0.1.30'
java {
toolchain {
diff --git a/plugins/jdbc/manifest.json b/plugins/jdbc/manifest.json
index b786f0dd53..2ebf614f2b 100644
--- a/plugins/jdbc/manifest.json
+++ b/plugins/jdbc/manifest.json
@@ -1,7 +1,7 @@
{
"id": "jdbc",
"name": "DBX JDBC Plugin",
- "version": "0.1.29",
+ "version": "0.1.30",
"protocol_version": 1,
"description": "Adds optional JDBC driver support to DBX.",
"executable": "bin/dbx-jdbc-plugin",
diff --git a/plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java b/plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java
index 7797395a1f..7dc3afc64c 100644
--- a/plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java
+++ b/plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java
@@ -535,7 +535,6 @@ public final class DbxJdbcPlugin {
properties.setProperty("password", password);
}
applyConnectTimeout(connection, properties);
- applyPagedFetchProperties(connection, url, properties);
applyJdbcxExtensionSecurity(connection, url, properties);
if (isOracleUrl(url)) {
applyOracleProperties(connection, properties);
@@ -626,25 +625,6 @@ public final class DbxJdbcPlugin {
normalized.equals("org.mariadb.jdbc.driver");
}
- private static void applyPagedFetchProperties(JsonNode connection, String url, Properties properties) {
- if (!isMysqlConnection(connection, url) || jdbcUrlHasParameter(url, "useCursorFetch")) {
- return;
- }
- properties.putIfAbsent("useCursorFetch", "true");
- }
-
- private static boolean isMysqlConnection(JsonNode connection, String url) {
- if (urlMatchesPrefix(url, "jdbc:mysql:")) {
- return true;
- }
- String driverClass = optionalText(connection, "jdbc_driver_class");
- if (driverClass == null) {
- return false;
- }
- String normalized = driverClass.toLowerCase(Locale.ROOT);
- return normalized.equals("com.mysql.cj.jdbc.driver") || normalized.equals("com.mysql.jdbc.driver");
- }
-
private static boolean isPostgresConnection(JsonNode connection) {
if (urlMatchesPrefix(jdbcUrl(connection), "jdbc:postgresql:")) {
return true;
diff --git a/plugins/jdbc/src/test/java/app/dbx/jdbc/DbxJdbcPluginTest.java b/plugins/jdbc/src/test/java/app/dbx/jdbc/DbxJdbcPluginTest.java
index 7aa2d53a9d..226b4fab2d 100644
--- a/plugins/jdbc/src/test/java/app/dbx/jdbc/DbxJdbcPluginTest.java
+++ b/plugins/jdbc/src/test/java/app/dbx/jdbc/DbxJdbcPluginTest.java
@@ -766,51 +766,24 @@ final class DbxJdbcPluginTest {
}
@Test
- void mysqlPagedQueriesEnableConnectorCursorFetchingByDefault() throws Exception {
- Method method = DbxJdbcPlugin.class.getDeclaredMethod(
- "applyPagedFetchProperties",
- JsonNode.class,
- String.class,
- Properties.class
- );
- method.setAccessible(true);
- Properties properties = new Properties();
- JsonNode connection = MAPPER.readTree("""
- {
- "connection_string": "jdbc:mysql://127.0.0.1:3306/app",
- "jdbc_driver_class": "com.mysql.cj.jdbc.Driver"
- }
- """);
-
- method.invoke(null, connection, "jdbc:mysql://127.0.0.1:3306/app", properties);
-
- assertEquals("true", properties.getProperty("useCursorFetch"));
- }
-
- @Test
- void mysqlPagedQueriesPreserveExplicitCursorFetchSetting() throws Exception {
- Method method = DbxJdbcPlugin.class.getDeclaredMethod(
- "applyPagedFetchProperties",
- JsonNode.class,
- String.class,
- Properties.class
- );
- method.setAccessible(true);
- Properties properties = new Properties();
- JsonNode connection = MAPPER.readTree("""
- {
- "connection_string": "jdbc:mysql://127.0.0.1:3306/app?useCursorFetch=false"
- }
- """);
-
- method.invoke(
- null,
- connection,
- "jdbc:mysql://127.0.0.1:3306/app?useCursorFetch=false",
- properties
- );
+ void mysqlConnectionsDoNotForceCursorFetch() throws Exception {
+ RecordingConnectDriver driver = new RecordingConnectDriver("jdbc:mysql:dbx-capture:");
+ DriverManager.registerDriver(driver);
+ try {
+ JsonNode response = request("testConnection", """
+ {
+ "connection": {
+ "connection_string": "jdbc:mysql:dbx-capture:demo",
+ "connect_timeout_secs": 30
+ }
+ }
+ """);
- assertFalse(properties.containsKey("useCursorFetch"));
+ assertFalse(response.has("error"), response.toString());
+ assertFalse(driver.properties.get(0).containsKey("useCursorFetch"));
+ } finally {
+ DriverManager.deregisterDriver(driver);
+ }
}
@Test