From 0143d8ab95555a45c14d869a2ef99617ec5a047b Mon Sep 17 00:00:00 2001
From: blankll
Date: Tue, 17 Nov 2026 11:52:59 +0800
Subject: [PATCH 01/16] feat(db): add Apache Cassandra and ScyllaDB support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Both stores connect through ING's open-source Cassandra JDBC wrapper
(Apache 2.0) as first-class connection types, sharing one pre-shaded
bundle JAR downloaded from the wrapper's GitHub releases:
- drivers.toml: replace the dead com.simba placeholder with the wrapper
bundle (version_cap 4.16.7, GBase-style direct download); pre-flight
cache naming now matches the Java resolver so a capped direct download
is stored once under its pinned name (fixes the same double-download
for GBase 8a)
- CQL metadata semantics: the wrapper maps keyspaces to JDBC schemas,
not catalogs — the JDBC adapter folds catalog into schema for both
stores, and list_databases reads keyspaces from system_schema
(the wrapper's catalog listing reports the cluster name)
- localdatacenter: driver 4.x requires an explicit local DC with
explicit contact points — the connection form gains a Local
Datacenter field (default datacenter1, i18n in 7 languages), composed
into the keyspace value; resolveDatabase backfills a bare keyspace
with system?localdatacenter=datacenter1
- ScyllaDB ships its own logo (simple-icons official mark) and the
connection list entry; the shared bundle/cache serves both
Verified end to end against Docker Cassandra 4.1.12 and ScyllaDB:
connect, DDL/DML, keyspace/table/column browsing with primary keys.
Note: ScyllaDB 6.x rejects SimpleStrategy (tablet replication) —
create keyspaces with NetworkTopologyStrategy.
---
src-tauri/src/commands/helpers.rs | 1 +
src-tauri/src/commands/jdbc.rs | 1 +
src-tauri/src/database/config.rs | 2 +
src-tauri/src/database/jdbc_bridge/adapter.rs | 65 ++++++++++++++++++-
.../src/database/jdbc_bridge/download.rs | 12 +++-
.../src/database/jdbc_bridge/drivers.toml | 32 ++++++++-
.../src/database/jdbc_bridge/fallback.rs | 6 +-
.../src/database/jdbc_bridge/registry.rs | 18 +++++
src-tauri/src/database/strategy.rs | 3 +
src-tauri/src/state.rs | 1 +
.../images/database-icons/scylladb-logo.svg | 1 +
.../connections/ServerFormDialog.vue | 44 ++++++++++++-
src/components/sidebar/dbCapabilities.ts | 1 +
src/composables/useDatabaseIcon.ts | 2 +
src/composables/useSqlFormatter.ts | 1 +
src/lang/enUS.ts | 3 +
src/lang/esES.ts | 3 +
src/lang/jaJP.ts | 3 +
src/lang/koKR.ts | 3 +
src/lang/ptBR.ts | 3 +
src/lang/zhCN.ts | 3 +
src/lang/zhTW.ts | 3 +
src/store/connectionStore.ts | 13 ++++
src/types/connection.ts | 1 +
24 files changed, 217 insertions(+), 8 deletions(-)
create mode 100644 src/assets/images/database-icons/scylladb-logo.svg
diff --git a/src-tauri/src/commands/helpers.rs b/src-tauri/src/commands/helpers.rs
index be66e6f9..795f7452 100644
--- a/src-tauri/src/commands/helpers.rs
+++ b/src-tauri/src/commands/helpers.rs
@@ -213,6 +213,7 @@ fn db_type_to_enum(db_type: &str) -> Result Ok(DatabaseType::Informix),
"kylin" => Ok(DatabaseType::Kylin),
"cassandra" => Ok(DatabaseType::Cassandra),
+ "scylladb" => Ok(DatabaseType::ScyllaDB),
"iris" | "intersystems_iris" => Ok(DatabaseType::Iris),
"access" | "ms_access" | "microsoft_access" => Ok(DatabaseType::Access),
_ => Err(format!("Unsupported database type: {}", db_type)),
diff --git a/src-tauri/src/commands/jdbc.rs b/src-tauri/src/commands/jdbc.rs
index 3d294600..0512b291 100644
--- a/src-tauri/src/commands/jdbc.rs
+++ b/src-tauri/src/commands/jdbc.rs
@@ -193,6 +193,7 @@ fn parse_db_type(s: &str) -> Result {
"informix" => Ok(DatabaseType::Informix),
"kylin" => Ok(DatabaseType::Kylin),
"cassandra" => Ok(DatabaseType::Cassandra),
+ "scylladb" => Ok(DatabaseType::ScyllaDB),
"iris" => Ok(DatabaseType::Iris),
"access" => Ok(DatabaseType::Access),
"tdengine" | "td" => Ok(DatabaseType::TDengine),
diff --git a/src-tauri/src/database/config.rs b/src-tauri/src/database/config.rs
index 8737b57b..15f2e568 100644
--- a/src-tauri/src/database/config.rs
+++ b/src-tauri/src/database/config.rs
@@ -137,6 +137,8 @@ pub enum DatabaseType {
Kylin,
/// Apache Cassandra — JDBC bridge.
Cassandra,
+ /// ScyllaDB — CQL-compatible wide-column store, JDBC bridge.
+ ScyllaDB,
/// InterSystems IRIS — JDBC bridge.
Iris,
/// Microsoft Access — JDBC bridge.
diff --git a/src-tauri/src/database/jdbc_bridge/adapter.rs b/src-tauri/src/database/jdbc_bridge/adapter.rs
index d09db5f9..688161e0 100644
--- a/src-tauri/src/database/jdbc_bridge/adapter.rs
+++ b/src-tauri/src/database/jdbc_bridge/adapter.rs
@@ -2,7 +2,7 @@
use crate::database::{
adapter::DatabaseAdapter,
- config::ConnectionConfig,
+ config::{ConnectionConfig, DatabaseType},
error::{DbError, DbResult},
types::{
ColumnInfo, ConnectionStatus, DatabaseSchema, ForeignKeyInfo, IndexInfo, ObjectInfo,
@@ -38,6 +38,28 @@ impl JdbcBridgeAdapter {
}
}
+ /// CQL stores (Cassandra/ScyllaDB) via the wrapper driver: the wrapper maps
+ /// keyspaces to JDBC schemas, not catalogs — its catalog lookup returns
+ /// nothing, so metadata RPCs must carry the keyspace in the schema slot.
+ fn is_cql(&self) -> bool {
+ matches!(
+ self.config.db_type,
+ DatabaseType::Cassandra | DatabaseType::ScyllaDB
+ )
+ }
+
+ fn fold_catalog_into_schema<'a>(
+ &self,
+ database: Option<&'a str>,
+ schema: Option<&'a str>,
+ ) -> (Option<&'a str>, Option<&'a str>) {
+ if self.is_cql() {
+ (None, schema.or(database))
+ } else {
+ (database, schema)
+ }
+ }
+
/// Ensure all prerequisites are met: JRE, bridge JAR, and JDBC driver.
/// Uses the fallback chain to try multiple driver versions automatically.
async fn init_bridge(&mut self) -> DbResult>> {
@@ -160,6 +182,7 @@ impl JdbcBridgeAdapter {
schema: Option<&str>,
table: Option<&str>,
) -> DbResult {
+ let (database, schema) = self.fold_catalog_into_schema(database, schema);
let launcher = self.launcher()?;
let data = Self::send_request(
launcher,
@@ -291,6 +314,37 @@ impl DatabaseAdapter for JdbcBridgeAdapter {
}
async fn list_databases(&self) -> DbResult> {
+ if self.is_cql() {
+ // The wrapper's catalog listing reports the cluster name, not
+ // keyspaces — read them from system_schema instead.
+ let launcher = self.launcher()?;
+ let data = Self::send_request(
+ launcher,
+ JdbcRequest::new(
+ JdbcMethod::ExecuteQuery,
+ serde_json::json!({
+ "conn_id": self.conn_id,
+ "sql": "SELECT keyspace_name FROM system_schema.keyspaces",
+ }),
+ ),
+ )
+ .await?;
+ let result = Self::parse_query_result(data)?;
+ return Ok(result
+ .rows
+ .iter()
+ .filter_map(|row| match row.get("keyspace_name") {
+ Some(QueryValue::String(name)) => Some(name.clone()),
+ _ => None,
+ })
+ .map(|name| DatabaseSchema {
+ is_system: name.starts_with("system"),
+ name,
+ description: None,
+ metadata: HashMap::new(),
+ })
+ .collect());
+ }
let launcher = self.launcher()?;
let data = Self::send_request(
launcher,
@@ -316,6 +370,12 @@ impl DatabaseAdapter for JdbcBridgeAdapter {
}
async fn list_schemas(&self, database: Option<&str>) -> DbResult> {
+ let (database, schema) = if self.is_cql() {
+ // The wrapper reports keyspaces as schemas — carry the database there.
+ (None, database)
+ } else {
+ (database, None)
+ };
let launcher = self.launcher()?;
let data = Self::send_request(
launcher,
@@ -324,6 +384,7 @@ impl DatabaseAdapter for JdbcBridgeAdapter {
serde_json::json!({
"conn_id": self.conn_id,
"database": database,
+ "schema": schema,
}),
),
)
@@ -337,6 +398,7 @@ impl DatabaseAdapter for JdbcBridgeAdapter {
database: Option<&str>,
schema: Option<&str>,
) -> DbResult> {
+ let (database, schema) = self.fold_catalog_into_schema(database, schema);
let launcher = self.launcher()?;
let data = Self::send_request(
launcher,
@@ -378,6 +440,7 @@ impl DatabaseAdapter for JdbcBridgeAdapter {
schema: Option<&str>,
table: &str,
) -> DbResult> {
+ let (database, schema) = self.fold_catalog_into_schema(database, schema);
let launcher = self.launcher()?;
let data = Self::send_request(
launcher,
diff --git a/src-tauri/src/database/jdbc_bridge/download.rs b/src-tauri/src/database/jdbc_bridge/download.rs
index 4ade2a69..2bf23584 100644
--- a/src-tauri/src/database/jdbc_bridge/download.rs
+++ b/src-tauri/src/database/jdbc_bridge/download.rs
@@ -321,9 +321,17 @@ pub async fn download_jdbc_driver_direct(db_type: &str) -> DbResult<()> {
return Ok(());
}
- // Drivers with a direct download URL (non-Maven, e.g. GBase 8a)
+ // Drivers with a direct download URL (non-Maven, e.g. GBase 8a or the
+ // Cassandra wrapper bundle). Name the cached file the way the Java
+ // resolver does (`{artifact}-{version}.jar`, version = cap ?? "1.0.0") so
+ // the pre-flight download satisfies both the pinned-cache lookup and the
+ // bridge's own ResolveDriver short-circuit instead of re-downloading.
if let Some(download_url) = &config.download_url {
- let jar_name = config.maven_artifact.clone() + ".jar";
+ let version = config
+ .version_cap
+ .clone()
+ .unwrap_or_else(|| "1.0.0".to_string());
+ let jar_name = format!("{}-{}.jar", config.maven_artifact, version);
let dest = dest_dir.join(&jar_name);
if dest.exists() {
return Ok(());
diff --git a/src-tauri/src/database/jdbc_bridge/drivers.toml b/src-tauri/src/database/jdbc_bridge/drivers.toml
index 6899efa6..ae052f43 100644
--- a/src-tauri/src/database/jdbc_bridge/drivers.toml
+++ b/src-tauri/src/database/jdbc_bridge/drivers.toml
@@ -304,12 +304,38 @@ min_jre_version = "11"
version_error_signatures = [ "driver version not compatible", ]
# ── Apache Cassandra ──
+#
+# Uses ING's open-source Cassandra JDBC wrapper (Apache 2.0), which wraps the
+# Cassandra java-driver 4.x and speaks plain `jdbc:cassandra://` URLs.
+# Maven Central only hosts the thin JAR, so we download the pre-shaded
+# "bundle" JAR (all deps included) from the wrapper's GitHub releases —
+# same direct-download flow as GBase 8a. The bundle supports
+# Cassandra 2.1–4.x, DSE and ScyllaDB.
[databases.cassandra]
name = "Apache Cassandra"
-class_name = "com.simba.cassandra.jdbc.Driver"
-maven_group = "com.simba"
-maven_artifact = "cassandra-jdbc"
+class_name = "com.ing.data.cassandra.jdbc.CassandraDriver"
+maven_group = "com.ing.data"
+maven_artifact = "cassandra-jdbc-wrapper"
+version_cap = "4.16.7"
+download_url = "https://github.com/ing-bank/cassandra-jdbc-wrapper/releases/download/v4.16.7/cassandra-jdbc-wrapper-4.16.7-bundle.jar"
+jdbc_url_template = "jdbc:cassandra://{host}:{port}/{database}"
+default_port = 9042
+min_jre_version = "11"
+version_error_signatures = [ "driver version not compatible", ]
+
+# ── ScyllaDB ──
+#
+# CQL-compatible wide-column store; shares the Cassandra wrapper bundle,
+# cache dir and JDBC URL scheme above.
+
+[databases.scylladb]
+name = "ScyllaDB"
+class_name = "com.ing.data.cassandra.jdbc.CassandraDriver"
+maven_group = "com.ing.data"
+maven_artifact = "cassandra-jdbc-wrapper"
+version_cap = "4.16.7"
+download_url = "https://github.com/ing-bank/cassandra-jdbc-wrapper/releases/download/v4.16.7/cassandra-jdbc-wrapper-4.16.7-bundle.jar"
jdbc_url_template = "jdbc:cassandra://{host}:{port}/{database}"
default_port = 9042
min_jre_version = "11"
diff --git a/src-tauri/src/database/jdbc_bridge/fallback.rs b/src-tauri/src/database/jdbc_bridge/fallback.rs
index cf3306b8..690db0d6 100644
--- a/src-tauri/src/database/jdbc_bridge/fallback.rs
+++ b/src-tauri/src/database/jdbc_bridge/fallback.rs
@@ -162,7 +162,10 @@ pub async fn try_driver(
// On the first attempt, try without version_cap (LATEST).
// If the config has no cap, or we're explicitly using it, send the cap.
- let effective_cap = if use_cap {
+ // Direct-download drivers are version-pinned by definition: always send
+ // the cap so the Java resolver names the cached JAR deterministically
+ // (a null cap would name it "-1.0.0.jar" and duplicate the download).
+ let effective_cap = if use_cap || config.download_url.is_some() {
config.version_cap.as_deref()
} else {
None
@@ -510,6 +513,7 @@ fn db_type_from_config(config: &DatabaseDriverConfig) -> DatabaseType {
"IBM Informix" => DatabaseType::Informix,
"Apache Kylin" => DatabaseType::Kylin,
"Apache Cassandra" => DatabaseType::Cassandra,
+ "ScyllaDB" => DatabaseType::ScyllaDB,
"InterSystems IRIS" => DatabaseType::Iris,
"Microsoft Access" => DatabaseType::Access,
_ => DatabaseType::PostgreSQL, // fallback, shouldn't happen
diff --git a/src-tauri/src/database/jdbc_bridge/registry.rs b/src-tauri/src/database/jdbc_bridge/registry.rs
index 8928b459..568e9a76 100644
--- a/src-tauri/src/database/jdbc_bridge/registry.rs
+++ b/src-tauri/src/database/jdbc_bridge/registry.rs
@@ -200,6 +200,7 @@ fn db_type_to_registry_key(db: DatabaseType) -> Option<&'static str> {
DatabaseType::Informix => Some("informix"),
DatabaseType::Kylin => Some("kylin"),
DatabaseType::Cassandra => Some("cassandra"),
+ DatabaseType::ScyllaDB => Some("scylladb"),
DatabaseType::Iris => Some("iris"),
DatabaseType::Access => Some("access"),
DatabaseType::YashanDB => Some("yashandb"),
@@ -238,6 +239,7 @@ mod tests {
assert!(registry.databases.contains_key("informix"));
assert!(registry.databases.contains_key("kylin"));
assert!(registry.databases.contains_key("cassandra"));
+ assert!(registry.databases.contains_key("scylladb"));
assert!(registry.databases.contains_key("iris"));
assert!(registry.databases.contains_key("access"));
}
@@ -250,6 +252,22 @@ mod tests {
assert_eq!(config.unwrap().name, "Oracle Database");
}
+ #[test]
+ fn test_cassandra_and_scylladb_share_driver_bundle() {
+ let registry = DriverRegistry::load();
+ let cassandra = registry
+ .get_config_by_name("cassandra")
+ .expect("cassandra should have a driver config");
+ let scylla = registry
+ .get_config_by_name("scylladb")
+ .expect("scylladb should have a driver config");
+ // Both entries resolve to the same wrapper bundle JAR and cache dir,
+ // so a single download serves both connection types.
+ assert_eq!(cassandra.maven_artifact, scylla.maven_artifact);
+ assert_eq!(cassandra.download_url, scylla.download_url);
+ assert_eq!(cassandra.version_cap, scylla.version_cap);
+ }
+
#[test]
fn test_get_config_db2_returns_config() {
let registry = DriverRegistry::load();
diff --git a/src-tauri/src/database/strategy.rs b/src-tauri/src/database/strategy.rs
index 86ffa02a..689f1261 100644
--- a/src-tauri/src/database/strategy.rs
+++ b/src-tauri/src/database/strategy.rs
@@ -84,6 +84,7 @@ pub fn resolve_effective_type(db: DatabaseType) -> ConnectionStrategy {
Informix => ConnectionStrategy::JdbcBridge,
Kylin => ConnectionStrategy::JdbcBridge,
Cassandra => ConnectionStrategy::JdbcBridge,
+ ScyllaDB => ConnectionStrategy::JdbcBridge,
Iris => ConnectionStrategy::JdbcBridge,
Access => ConnectionStrategy::JdbcBridge,
YashanDB => ConnectionStrategy::JdbcBridge,
@@ -154,6 +155,7 @@ pub fn default_port(db: DatabaseType) -> Option {
Informix => Some(9088),
Kylin => Some(7070),
Cassandra => Some(9042),
+ ScyllaDB => Some(9042),
Iris => Some(1972),
Access => Some(0),
Trino => Some(8080),
@@ -270,6 +272,7 @@ mod tests {
DatabaseType::Informix,
DatabaseType::Kylin,
DatabaseType::Cassandra,
+ DatabaseType::ScyllaDB,
DatabaseType::Iris,
DatabaseType::Access,
DatabaseType::YashanDB,
diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rs
index 009ac1d2..f212fd09 100644
--- a/src-tauri/src/state.rs
+++ b/src-tauri/src/state.rs
@@ -214,6 +214,7 @@ impl ServerConfig {
"informix" => Ok(DatabaseType::Informix),
"kylin" => Ok(DatabaseType::Kylin),
"cassandra" => Ok(DatabaseType::Cassandra),
+ "scylladb" => Ok(DatabaseType::ScyllaDB),
"iris" => Ok(DatabaseType::Iris),
"access" => Ok(DatabaseType::Access),
_ => Err(format!("Unsupported database type: {}", self.db_type)),
diff --git a/src/assets/images/database-icons/scylladb-logo.svg b/src/assets/images/database-icons/scylladb-logo.svg
new file mode 100644
index 00000000..f6da258d
--- /dev/null
+++ b/src/assets/images/database-icons/scylladb-logo.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/components/connections/ServerFormDialog.vue b/src/components/connections/ServerFormDialog.vue
index f27cbffd..867e678d 100644
--- a/src/components/connections/ServerFormDialog.vue
+++ b/src/components/connections/ServerFormDialog.vue
@@ -117,6 +117,7 @@ const defaultPorts: Record = {
[DatabaseType.INFORMIX]: 9088,
[DatabaseType.KYLIN]: 7070,
[DatabaseType.CASSANDRA]: 9042,
+ [DatabaseType.SCYLLADB]: 9042,
[DatabaseType.IRIS]: 1972,
[DatabaseType.ACCESS]: 0,
[DatabaseType.FIREBIRD]: 3050,
@@ -137,6 +138,32 @@ const defaultConnection: ServerConnection = {
}
const formData = ref({ ...defaultConnection })
+// CQL stores (Cassandra/ScyllaDB) need an explicit local datacenter for the
+// driver's default load-balancing policy — kept as its own field and composed
+// into the keyspace value on save/test (see resolveDatabase on the store side).
+const isCassandraFamily = computed(() =>
+ formData.value.type === DatabaseType.CASSANDRA || formData.value.type === DatabaseType.SCYLLADB,
+)
+const localDatacenter = ref('datacenter1')
+
+const databaseWithLocalDc = () => {
+ if (!isCassandraFamily.value)
+ return formData.value.database
+ const keyspace = formData.value.database?.trim() || 'system'
+ const dc = localDatacenter.value.trim() || 'datacenter1'
+ return `${keyspace}?localdatacenter=${dc}`
+}
+
+const splitLocalDatacenter = (database?: string) => {
+ if (!isCassandraFamily.value || !database?.includes('localdatacenter='))
+ return
+ const [keyspace, query = ''] = database.split('?')
+ const param = query.split('&').find(p => p.startsWith('localdatacenter='))
+ if (param) {
+ localDatacenter.value = param.slice('localdatacenter='.length) || 'datacenter1'
+ formData.value.database = keyspace
+ }
+}
const testStatus = ref<'idle' | 'testing' | 'success' | 'error'>('idle')
const testError = ref('')
/** The last test ran without the saved SSH tunnel (Ultimate-only feature). */
@@ -229,6 +256,7 @@ watch(() => props.open, (open) => {
if (open) {
if (props.connection) {
formData.value = { ...props.connection }
+ splitLocalDatacenter(formData.value.database)
// Detect SQLite mode from path
if (props.connection.type === DatabaseType.SQLITE) {
if (props.connection.host === ':memory:') {
@@ -792,7 +820,7 @@ async function handleTestConnection() {
port: formData.value.port,
username: formData.value.username || '',
password: formData.value.password || undefined,
- database: resolveDatabase(formData.value.type, formData.value.database) ?? undefined,
+ database: resolveDatabase(formData.value.type, databaseWithLocalDc()) ?? undefined,
ssl_mode: sslModeToBackend(formData.value.ssl),
ssl_ca_cert: formData.value.ssl.caCertPath || null,
ssl_client_cert: formData.value.ssl.clientCertPath || null,
@@ -903,6 +931,9 @@ function handleSave() {
return
}
+ if (isCassandraFamily.value)
+ formData.value.database = databaseWithLocalDc()
+
emit('save', { ...formData.value })
isOpen.value = false
}
@@ -1023,6 +1054,17 @@ function handleSave() {
{{ formErrors.database }}
+
+
+
+
diff --git a/src/components/sidebar/dbCapabilities.ts b/src/components/sidebar/dbCapabilities.ts
index c2b32f45..abb7d430 100644
--- a/src/components/sidebar/dbCapabilities.ts
+++ b/src/components/sidebar/dbCapabilities.ts
@@ -112,6 +112,7 @@ const CAPABILITY_MAP: Partial> = {
[DatabaseType.INFORMIX]: { ...ALL, materializedViews: false },
[DatabaseType.KYLIN]: { ...ALL, newDatabase: false, newSchema: false, dropDatabase: false },
[DatabaseType.CASSANDRA]: { ...NONE, export: true, views: false },
+ [DatabaseType.SCYLLADB]: { ...NONE, export: true, views: false },
[DatabaseType.IRIS]: { ...ALL, materializedViews: false },
[DatabaseType.ACCESS]: { ...NONE, export: true, views: true },
[DatabaseType.FIREBIRD]: { ...ALL, materializedViews: false },
diff --git a/src/composables/useDatabaseIcon.ts b/src/composables/useDatabaseIcon.ts
index 567828e5..505def4d 100644
--- a/src/composables/useDatabaseIcon.ts
+++ b/src/composables/useDatabaseIcon.ts
@@ -43,6 +43,7 @@ import prestoLogo from '@/assets/images/database-icons/presto-logo.svg'
import questdbLogo from '@/assets/images/database-icons/questdb-logo.svg'
import redshiftLogo from '@/assets/images/database-icons/redshift-logo.svg'
import rqliteLogo from '@/assets/images/database-icons/rqlite-logo.svg'
+import scylladbLogo from '@/assets/images/database-icons/scylladb-logo.svg'
import selectdbLogo from '@/assets/images/database-icons/selectdb-logo.svg'
import singlestoreLogo from '@/assets/images/database-icons/singlestorememsql-logo.svg'
import snowflakeLogo from '@/assets/images/database-icons/snowflake-logo.svg'
@@ -122,6 +123,7 @@ const databaseIcons: Record = {
INFORMIX: { icon: informixLogo, color: 'bg-blue-100 dark:bg-blue-900/30' },
KYLIN: { icon: kylinLogo, color: 'bg-blue-100 dark:bg-blue-900/30' },
CASSANDRA: { icon: cassandraLogo, color: 'bg-gray-100 dark:bg-gray-800/30' },
+ SCYLLADB: { icon: scylladbLogo, color: 'bg-teal-100 dark:bg-teal-900/30' },
IRIS: { icon: irisLogo, color: 'bg-teal-100 dark:bg-teal-900/30' },
ACCESS: { icon: accessLogo, color: 'bg-red-100 dark:bg-red-900/30' },
FIREBIRD: { icon: firebirdLogo, color: 'bg-purple-100 dark:bg-purple-900/30' },
diff --git a/src/composables/useSqlFormatter.ts b/src/composables/useSqlFormatter.ts
index 9dab1b0e..bdc7c2d2 100644
--- a/src/composables/useSqlFormatter.ts
+++ b/src/composables/useSqlFormatter.ts
@@ -84,6 +84,7 @@ const dialectMap: Record = {
[DatabaseType.INFORMIX]: 'sql',
[DatabaseType.KYLIN]: 'sql',
[DatabaseType.CASSANDRA]: 'sql',
+ [DatabaseType.SCYLLADB]: 'sql',
[DatabaseType.IRIS]: 'sql',
[DatabaseType.ACCESS]: 'sql',
}
diff --git a/src/lang/enUS.ts b/src/lang/enUS.ts
index a50f388f..67d0971d 100644
--- a/src/lang/enUS.ts
+++ b/src/lang/enUS.ts
@@ -1189,6 +1189,7 @@ export const enUS = {
encryptionKey: 'Encryption Key',
port: 'Port',
database: 'Database',
+ localDatacenter: 'Local Datacenter',
username: 'Username',
password: 'Password',
ssl: 'Use SSL/TLS encryption',
@@ -1203,6 +1204,7 @@ export const enUS = {
duckdbFilePath: '/path/to/database.duckdb or :memory:',
encryptionKey: 'Enter encryption passphrase',
database: 'database_name',
+ localDatacenter: 'datacenter1',
username: 'username',
password: '••••••••',
},
@@ -1259,6 +1261,7 @@ export const enUS = {
'informix': 'IBM Informix',
'kylin': 'Apache Kylin',
'cassandra': 'Apache Cassandra',
+ 'scylladb': 'ScyllaDB',
'iris': 'InterSystems IRIS',
'access': 'Microsoft Access',
'firebird': 'Firebird',
diff --git a/src/lang/esES.ts b/src/lang/esES.ts
index 4e40a67d..efe8f012 100644
--- a/src/lang/esES.ts
+++ b/src/lang/esES.ts
@@ -1189,6 +1189,7 @@ export const esES = {
encryptionKey: 'Clave de cifrado',
port: 'Puerto',
database: 'Base de datos',
+ localDatacenter: 'Datacenter local',
username: 'Usuario',
password: 'Contraseña',
ssl: 'Usar cifrado SSL/TLS',
@@ -1203,6 +1204,7 @@ export const esES = {
duckdbFilePath: '/path/to/database.duckdb or :memory:',
encryptionKey: 'Introduce la frase de contraseña de cifrado',
database: 'database_name',
+ localDatacenter: 'datacenter1',
username: 'username',
password: '••••••••',
},
@@ -1259,6 +1261,7 @@ export const esES = {
'informix': 'IBM Informix',
'kylin': 'Apache Kylin',
'cassandra': 'Apache Cassandra',
+ 'scylladb': 'ScyllaDB',
'iris': 'InterSystems IRIS',
'access': 'Microsoft Access',
'firebird': 'Firebird',
diff --git a/src/lang/jaJP.ts b/src/lang/jaJP.ts
index aef2dde6..75f4c263 100644
--- a/src/lang/jaJP.ts
+++ b/src/lang/jaJP.ts
@@ -1188,6 +1188,7 @@ export const jaJP = {
encryptionKey: '暗号化キー',
port: 'ポート',
database: 'データベース',
+ localDatacenter: 'ローカルデータセンター',
username: 'ユーザー名',
password: 'パスワード',
ssl: 'SSL/TLS 暗号化を使用',
@@ -1202,6 +1203,7 @@ export const jaJP = {
duckdbFilePath: '/path/to/database.duckdb or :memory:',
encryptionKey: '暗号化パスフレーズを入力',
database: 'database_name',
+ localDatacenter: 'datacenter1',
username: 'username',
password: '••••••••',
},
@@ -1258,6 +1260,7 @@ export const jaJP = {
'informix': 'IBM Informix',
'kylin': 'Apache Kylin',
'cassandra': 'Apache Cassandra',
+ 'scylladb': 'ScyllaDB',
'iris': 'InterSystems IRIS',
'access': 'Microsoft Access',
'firebird': 'Firebird',
diff --git a/src/lang/koKR.ts b/src/lang/koKR.ts
index f1dbcc3d..25de2df9 100644
--- a/src/lang/koKR.ts
+++ b/src/lang/koKR.ts
@@ -1189,6 +1189,7 @@ export const koKR = {
encryptionKey: '암호화 키',
port: '포트',
database: '데이터베이스',
+ localDatacenter: '로컬 데이터센터',
username: '사용자 이름',
password: '비밀번호',
ssl: 'SSL/TLS 암호화 사용',
@@ -1203,6 +1204,7 @@ export const koKR = {
duckdbFilePath: '/path/to/database.duckdb 또는 :memory:',
encryptionKey: '암호화 패스프레이즈 입력',
database: 'database_name',
+ localDatacenter: 'datacenter1',
username: 'username',
password: '••••••••',
},
@@ -1259,6 +1261,7 @@ export const koKR = {
'informix': 'IBM Informix',
'kylin': 'Apache Kylin',
'cassandra': 'Apache Cassandra',
+ 'scylladb': 'ScyllaDB',
'iris': 'InterSystems IRIS',
'access': 'Microsoft Access',
'firebird': 'Firebird',
diff --git a/src/lang/ptBR.ts b/src/lang/ptBR.ts
index acbfab54..2282a975 100644
--- a/src/lang/ptBR.ts
+++ b/src/lang/ptBR.ts
@@ -1189,6 +1189,7 @@ export const ptBR = {
encryptionKey: 'Chave de criptografia',
port: 'Porta',
database: 'Banco de dados',
+ localDatacenter: 'Datacenter local',
username: 'Usuário',
password: 'Senha',
ssl: 'Usar criptografia SSL/TLS',
@@ -1203,6 +1204,7 @@ export const ptBR = {
duckdbFilePath: '/path/to/database.duckdb or :memory:',
encryptionKey: 'Digite a frase secreta de criptografia',
database: 'database_name',
+ localDatacenter: 'datacenter1',
username: 'username',
password: '••••••••',
},
@@ -1259,6 +1261,7 @@ export const ptBR = {
'informix': 'IBM Informix',
'kylin': 'Apache Kylin',
'cassandra': 'Apache Cassandra',
+ 'scylladb': 'ScyllaDB',
'iris': 'InterSystems IRIS',
'access': 'Microsoft Access',
'firebird': 'Firebird',
diff --git a/src/lang/zhCN.ts b/src/lang/zhCN.ts
index e62dbead..de047554 100644
--- a/src/lang/zhCN.ts
+++ b/src/lang/zhCN.ts
@@ -1189,6 +1189,7 @@ export const zhCN = {
encryptionKey: '加密密钥',
port: '端口',
database: '数据库',
+ localDatacenter: '本地数据中心',
username: '用户名',
password: '密码',
ssl: '使用SSL/TLS加密',
@@ -1203,6 +1204,7 @@ export const zhCN = {
encryptionKey: '输入加密口令',
duckdbFilePath: '/path/to/database.duckdb 或 :memory:',
database: 'database_name',
+ localDatacenter: 'datacenter1',
username: 'username',
password: '••••••••',
},
@@ -1259,6 +1261,7 @@ export const zhCN = {
'informix': 'IBM Informix',
'kylin': 'Apache Kylin',
'cassandra': 'Apache Cassandra',
+ 'scylladb': 'ScyllaDB',
'iris': 'InterSystems IRIS',
'access': 'Microsoft Access',
'firebird': 'Firebird',
diff --git a/src/lang/zhTW.ts b/src/lang/zhTW.ts
index 24401035..920b7eb3 100644
--- a/src/lang/zhTW.ts
+++ b/src/lang/zhTW.ts
@@ -1188,6 +1188,7 @@ export const zhTW = {
encryptionKey: '加密金鑰',
port: '連接埠',
database: '資料庫',
+ localDatacenter: '本地資料中心',
username: '使用者名稱',
password: '密碼',
ssl: '使用 SSL/TLS 加密',
@@ -1202,6 +1203,7 @@ export const zhTW = {
duckdbFilePath: '/path/to/database.duckdb 或 :memory:',
encryptionKey: '輸入加密密碼短語',
database: 'database_name',
+ localDatacenter: 'datacenter1',
username: 'username',
password: '••••••••',
},
@@ -1258,6 +1260,7 @@ export const zhTW = {
'informix': 'IBM Informix',
'kylin': 'Apache Kylin',
'cassandra': 'Apache Cassandra',
+ 'scylladb': 'ScyllaDB',
'iris': 'InterSystems IRIS',
'access': 'Microsoft Access',
'firebird': 'Firebird',
diff --git a/src/store/connectionStore.ts b/src/store/connectionStore.ts
index 2072b7a1..b04521ea 100644
--- a/src/store/connectionStore.ts
+++ b/src/store/connectionStore.ts
@@ -61,6 +61,7 @@ export enum DatabaseType {
INFORMIX = 'INFORMIX',
KYLIN = 'KYLIN',
CASSANDRA = 'CASSANDRA',
+ SCYLLADB = 'SCYLLADB',
IRIS = 'IRIS',
ACCESS = 'ACCESS',
FIREBIRD = 'FIREBIRD',
@@ -134,6 +135,7 @@ export const dbTypeToBackend: Record = {
[DatabaseType.INFORMIX]: 'informix',
[DatabaseType.KYLIN]: 'kylin',
[DatabaseType.CASSANDRA]: 'cassandra',
+ [DatabaseType.SCYLLADB]: 'scylladb',
[DatabaseType.IRIS]: 'iris',
[DatabaseType.ACCESS]: 'access',
[DatabaseType.FIREBIRD]: 'firebird',
@@ -205,6 +207,7 @@ export const dbTypeFromBackend: Record = {
'informix': DatabaseType.INFORMIX,
'kylin': DatabaseType.KYLIN,
'cassandra': DatabaseType.CASSANDRA,
+ 'scylladb': DatabaseType.SCYLLADB,
'iris': DatabaseType.IRIS,
'access': DatabaseType.ACCESS,
'firebird': DatabaseType.FIREBIRD,
@@ -243,6 +246,8 @@ const defaultDatabaseFor: Partial> = {
[DatabaseType.CRATEDB]: 'crate',
[DatabaseType.QUESTDB]: 'qdb',
[DatabaseType.KINGBASEES]: 'test',
+ [DatabaseType.CASSANDRA]: 'keyspace (default: system)',
+ [DatabaseType.SCYLLADB]: 'keyspace (default: system)',
}
const requiredDatabaseFor: Set = new Set([
@@ -262,6 +267,14 @@ function isDatabaseRequired(type: DatabaseType): boolean {
}
function resolveDatabase(type: DatabaseType, database?: string): string | null {
+ if (type === DatabaseType.CASSANDRA || type === DatabaseType.SCYLLADB) {
+ // The wrapper driver refuses to connect without a keyspace and an explicit
+ // local datacenter; `system` always exists and `datacenter1` is the stock
+ // single-DC name. A persisted value that already carries the parameter
+ // (composed by the connection form) is passed through untouched.
+ const db = database?.trim() || 'system'
+ return db.includes('localdatacenter=') ? db : `${db}?localdatacenter=datacenter1`
+ }
return database || defaultDatabaseFor[type] || null
}
diff --git a/src/types/connection.ts b/src/types/connection.ts
index d2b68465..c5d3376f 100644
--- a/src/types/connection.ts
+++ b/src/types/connection.ts
@@ -100,6 +100,7 @@ export const CERT_FIELD_DATABASES = [
'informix',
'kylin',
'cassandra',
+ 'scylladb',
'iris',
'dameng',
'xugudb',
From a9ee236a4b62d01789c9d521b83202102358a846 Mon Sep 17 00:00:00 2001
From: blankll
Date: Tue, 17 Nov 2026 15:24:30 +0800
Subject: [PATCH 02/16] fix(db): read CQL metadata from system_schema, not
DatabaseMetaData
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The wrapper's DatabaseMetaData only reports objects of the keyspace bound
at connect time and ignores the catalog/schema arguments. Switching
keyspace in the UI does not reconnect, so browsing a keyspace other than
the one used at connect returned empty lists — reproducible over SSH
tunnels and plain connections alike.
list_tables and list_columns now query system_schema directly, which also
keeps working when the session keyspace is `system`. Primary-key flags
come from system_schema.columns.kind (partition_key/clustering), and
key columns are ordered first to mirror CQL's layout.
Found while validating Cassandra through an SSH bastion.
---
src-tauri/src/database/jdbc_bridge/adapter.rs | 118 +++++++++++++++---
src-tauri/src/database/types.rs | 10 ++
2 files changed, 109 insertions(+), 19 deletions(-)
diff --git a/src-tauri/src/database/jdbc_bridge/adapter.rs b/src-tauri/src/database/jdbc_bridge/adapter.rs
index 688161e0..dd266f1f 100644
--- a/src-tauri/src/database/jdbc_bridge/adapter.rs
+++ b/src-tauri/src/database/jdbc_bridge/adapter.rs
@@ -60,6 +60,24 @@ impl JdbcBridgeAdapter {
}
}
+ /// Run a CQL query and return its rows, bypassing `DatabaseMetaData` for
+ /// introspection (see `list_tables` / `list_columns`).
+ async fn cql_rows(&self, sql: &str) -> DbResult> {
+ let launcher = self.launcher()?;
+ let data = Self::send_request(
+ launcher,
+ JdbcRequest::new(
+ JdbcMethod::ExecuteQuery,
+ serde_json::json!({
+ "conn_id": self.conn_id,
+ "sql": sql,
+ }),
+ ),
+ )
+ .await?;
+ Ok(Self::parse_query_result(data)?.rows)
+ }
+
/// Ensure all prerequisites are met: JRE, bridge JAR, and JDBC driver.
/// Uses the fallback chain to try multiple driver versions automatically.
async fn init_bridge(&mut self) -> DbResult>> {
@@ -317,26 +335,11 @@ impl DatabaseAdapter for JdbcBridgeAdapter {
if self.is_cql() {
// The wrapper's catalog listing reports the cluster name, not
// keyspaces — read them from system_schema instead.
- let launcher = self.launcher()?;
- let data = Self::send_request(
- launcher,
- JdbcRequest::new(
- JdbcMethod::ExecuteQuery,
- serde_json::json!({
- "conn_id": self.conn_id,
- "sql": "SELECT keyspace_name FROM system_schema.keyspaces",
- }),
- ),
- )
- .await?;
- let result = Self::parse_query_result(data)?;
- return Ok(result
- .rows
+ return Ok(self
+ .cql_rows("SELECT keyspace_name FROM system_schema.keyspaces")
+ .await?
.iter()
- .filter_map(|row| match row.get("keyspace_name") {
- Some(QueryValue::String(name)) => Some(name.clone()),
- _ => None,
- })
+ .filter_map(|row| row.get("keyspace_name").and_then(|v| v.as_string()))
.map(|name| DatabaseSchema {
is_system: name.starts_with("system"),
name,
@@ -398,6 +401,41 @@ impl DatabaseAdapter for JdbcBridgeAdapter {
database: Option<&str>,
schema: Option<&str>,
) -> DbResult> {
+ if self.is_cql() {
+ // The wrapper's DatabaseMetaData only reports objects of the
+ // keyspace bound at connect time and ignores the catalog/schema
+ // arguments — so browsing a keyspace picked later in the UI would
+ // come back empty. Read system_schema directly instead, which also
+ // keeps working when the session keyspace is `system`.
+ let keyspace = schema.or(database);
+ let sql = match keyspace {
+ Some(ks) => format!(
+ "SELECT table_name FROM system_schema.tables WHERE keyspace_name = '{}'",
+ ks.replace('\'', "''")
+ ),
+ None => "SELECT keyspace_name, table_name FROM system_schema.tables".to_string(),
+ };
+ let rows = self.cql_rows(&sql).await?;
+ return Ok(rows
+ .iter()
+ .filter_map(|row| {
+ let table = row.get("table_name")?.as_string()?;
+ let ks = row
+ .get("keyspace_name")
+ .and_then(|v| v.as_string())
+ .or_else(|| keyspace.map(|k| k.to_string()));
+ Some(TableInfo {
+ schema: ks,
+ name: table,
+ table_type: "TABLE".to_string(),
+ row_count: None,
+ size_bytes: None,
+ description: None,
+ metadata: HashMap::new(),
+ })
+ })
+ .collect());
+ }
let (database, schema) = self.fold_catalog_into_schema(database, schema);
let launcher = self.launcher()?;
let data = Self::send_request(
@@ -440,6 +478,48 @@ impl DatabaseAdapter for JdbcBridgeAdapter {
schema: Option<&str>,
table: &str,
) -> DbResult> {
+ if self.is_cql() {
+ // Same session-keyspace limitation as list_tables: read the column
+ // definitions (and primary-key flags) from system_schema.
+ let Some(keyspace) = schema.or(database) else {
+ return Ok(Vec::new());
+ };
+ let sql = format!(
+ "SELECT column_name, kind, position, type FROM system_schema.columns \
+ WHERE keyspace_name = '{}' AND table_name = '{}'",
+ keyspace.replace('\'', "''"),
+ table.replace('\'', "''")
+ );
+ let mut cols: Vec<(String, bool, String)> = self
+ .cql_rows(&sql)
+ .await?
+ .iter()
+ .filter_map(|row| {
+ let name = row.get("column_name").and_then(|v| v.as_string())?;
+ let kind = row.get("kind").and_then(|v| v.as_string()).unwrap_or_default();
+ let ty = row.get("type").and_then(|v| v.as_string()).unwrap_or_default();
+ Some((name, kind.contains("partition_key") || kind.contains("clustering"), ty))
+ })
+ .collect();
+ // Primary-key columns first, then the rest, mirroring CQL's layout.
+ cols.sort_by_key(|(_, is_pk, _)| !*is_pk);
+ return Ok(cols
+ .into_iter()
+ .map(|(name, is_primary_key, data_type)| ColumnInfo {
+ name,
+ data_type,
+ nullable: !is_primary_key,
+ default_value: None,
+ is_primary_key,
+ is_auto_increment: false,
+ max_length: None,
+ precision: None,
+ scale: None,
+ description: None,
+ metadata: HashMap::new(),
+ })
+ .collect());
+ }
let (database, schema) = self.fold_catalog_into_schema(database, schema);
let launcher = self.launcher()?;
let data = Self::send_request(
diff --git a/src-tauri/src/database/types.rs b/src-tauri/src/database/types.rs
index 96c557aa..42df71c6 100644
--- a/src-tauri/src/database/types.rs
+++ b/src-tauri/src/database/types.rs
@@ -89,6 +89,16 @@ pub enum QueryValue {
DateTime(String),
}
+impl QueryValue {
+ /// Text of a string-like value, or `None` for any other variant.
+ pub fn as_string(&self) -> Option {
+ match self {
+ QueryValue::String(s) | QueryValue::DateTime(s) => Some(s.clone()),
+ _ => None,
+ }
+ }
+}
+
/// Represents a single row in a query result.
pub type QueryRow = HashMap;
From 255aa8be44a79a98323d89ed43a3287ac04fb090 Mon Sep 17 00:00:00 2001
From: blankll
Date: Tue, 17 Nov 2026 16:54:30 +0800
Subject: [PATCH 03/16] fix(db): enforce CQL TLS and repair keyspace browsing
---
README.md | 2 +-
docs/SSL_UI_DESIGN.md | 4 +
.../java/sqlkit/bridge/ConnectionManager.java | 46 ++++++--
.../java/sqlkit/bridge/ProtocolHandler.java | 1 +
.../java/sqlkit/bridge/SslPropertyMapper.java | 100 ++++++++++++++++++
.../sqlkit/bridge/SslPropertyMapperTest.java | 13 +++
src-tauri/src/commands/browse.rs | 44 ++++++++
src-tauri/src/database/config.rs | 34 +++++-
src-tauri/src/database/jdbc_bridge/adapter.rs | 84 +++++++++++----
.../src/database/jdbc_bridge/drivers.toml | 4 +-
.../src/database/jdbc_bridge/fallback.rs | 16 ++-
.../src/database/jdbc_bridge/protocol.rs | 1 +
src-tauri/src/state.rs | 28 +++++
src/__tests__/dataTablePagination.test.ts | 27 ++++-
.../connections/ServerFormDialog.vue | 13 ++-
.../database-browser/DataTableView.vue | 16 ++-
.../pagination/PaginationControls.vue | 19 ++--
src/lang/enUS.ts | 2 +
src/lang/esES.ts | 2 +
src/lang/jaJP.ts | 2 +
src/lang/koKR.ts | 2 +
src/lang/ptBR.ts | 2 +
src/lang/zhCN.ts | 2 +
src/lang/zhTW.ts | 2 +
src/pages/QueriesPage.vue | 3 +
src/store/connectionStore.ts | 12 +--
26 files changed, 414 insertions(+), 67 deletions(-)
diff --git a/README.md b/README.md
index 7a1fb0cc..b2e2d370 100644
--- a/README.md
+++ b/README.md
@@ -157,7 +157,7 @@ SqlKit supports **70+ databases** across four adapter strategies:
| **Native** (Rust) | PostgreSQL, MySQL, SQL Server, SQLite |
| **PG-wire compat** | CockroachDB, Redshift, YugabyteDB, TimescaleDB, QuestDB, Vastbase, YashanDB, KingbaseES, GaussDB, HighGo, UXDB, OpenGauss, GBase8c, Greenplum, EnterpriseDB, CrateDB, Materialize, AlloyDB, CloudSQLPG, FujitsuPG |
| **MySQL-wire compat** | MariaDB, TiDB, OceanBase, TDSQL, PolarDB, Doris, SelectDB, StarRocks, Databend, GoldenDB, ManticoreSearch, SingleStore, CloudSQLMySQL |
-| **JDBC bridge** | Oracle, DuckDB, Firebird, DB2, H2, Snowflake, TDengine, Derby, Hive, Databricks, Hana, Teradata, Vertica, Exasol, BigQuery, Informix, Kylin, Cassandra, Iris, Access, Dameng, XuguDB, GBase8a |
+| **JDBC bridge** | Oracle, DuckDB, Firebird, DB2, H2, Snowflake, TDengine, Derby, Hive, Databricks, Hana, Teradata, Vertica, Exasol, BigQuery, Informix, Kylin, Cassandra (3.0+), ScyllaDB, Iris, Access, Dameng, XuguDB, GBase8a |
| **HTTP bridge** | ClickHouse, Trino, Presto, RQLite, Turso |
### Product-Grade Editor
diff --git a/docs/SSL_UI_DESIGN.md b/docs/SSL_UI_DESIGN.md
index 3c094bc5..9b46e570 100644
--- a/docs/SSL_UI_DESIGN.md
+++ b/docs/SSL_UI_DESIGN.md
@@ -33,6 +33,10 @@ Database-specific SSL configuration with dropdown selector + conditional fields.
---
+## Apache Cassandra and ScyllaDB
+
+Require, Verify CA, and Verify Full use TLS for both engines. Require uses the JVM trust store with no hostname check. Verify CA uses the configured CA, and Verify Full also checks the hostname. The certificate and private key fields configure client authentication when both are supplied.
+
## PostgreSQL
### UI Layout
diff --git a/jdbc-bridge/src/main/java/sqlkit/bridge/ConnectionManager.java b/jdbc-bridge/src/main/java/sqlkit/bridge/ConnectionManager.java
index da0f0339..93f443fb 100644
--- a/jdbc-bridge/src/main/java/sqlkit/bridge/ConnectionManager.java
+++ b/jdbc-bridge/src/main/java/sqlkit/bridge/ConnectionManager.java
@@ -14,6 +14,7 @@ public class ConnectionManager {
private final Map pools = new HashMap<>();
private final Map loaders = new HashMap<>();
+ private final Map cqlTls = new HashMap<>();
/**
* Driver classes loaded once per JAR set.
@@ -62,7 +63,10 @@ public void connect(String connId, String url, String username,
final java.sql.Driver driver = sharedDriver(driverClass, driverJars);
DriverClassLoader loader = loaderFor(driverJars);
- loaders.put(connId, loader);
+ final SslPropertyMapper.CqlTlsSettings tls = SslPropertyMapper.requiresCqlTls(driverClass, sslMode)
+ ? SslPropertyMapper.cqlTlsSettings(jdbcUrl, username, password, sslMode,
+ sslCaCert, sslClientCert, sslClientKey)
+ : null;
HikariConfig config = new HikariConfig();
// Keep HikariCP's read-only flag aligned with the connection the driver
@@ -75,14 +79,22 @@ public java.sql.Connection getConnection() throws java.sql.SQLException {
java.util.Properties info = new java.util.Properties();
if (username != null) info.setProperty("user", username);
if (password != null) info.setProperty("password", password);
- SslPropertyMapper.applySslProperties(driverClass, jdbcUrl, sslMode, sslCaCert, sslClientCert, sslClientKey, trustServerCertificate, info);
+ if (tls != null) {
+ info.putAll(tls.properties);
+ } else {
+ SslPropertyMapper.applySslProperties(driverClass, jdbcUrl, sslMode, sslCaCert, sslClientCert, sslClientKey, trustServerCertificate, info);
+ }
return driver.connect(jdbcUrl, info);
}
public java.sql.Connection getConnection(String u, String p) throws java.sql.SQLException {
java.util.Properties info = new java.util.Properties();
if (u != null) info.setProperty("user", u);
if (p != null) info.setProperty("password", p);
- SslPropertyMapper.applySslProperties(driverClass, jdbcUrl, sslMode, sslCaCert, sslClientCert, sslClientKey, trustServerCertificate, info);
+ if (tls != null) {
+ info.putAll(tls.properties);
+ } else {
+ SslPropertyMapper.applySslProperties(driverClass, jdbcUrl, sslMode, sslCaCert, sslClientCert, sslClientKey, trustServerCertificate, info);
+ }
return driver.connect(jdbcUrl, info);
}
public java.io.PrintWriter getLogWriter() { return null; }
@@ -104,18 +116,28 @@ public void setLoginTimeout(int seconds) {}
config.setIdleTimeout(600000);
config.setMaxLifetime(1800000);
- HikariDataSource ds = new HikariDataSource(config);
-
- // Verify connection works
- try (Connection c = ds.getConnection()) {
- // ok
+ HikariDataSource ds = null;
+ try {
+ ds = new HikariDataSource(config);
+ try (Connection c = ds.getConnection()) {
+ // Verify the pool can open a connection.
+ }
} catch (Exception e) {
- ds.close();
+ if (ds != null) {
+ ds.close();
+ }
+ if (tls != null) {
+ tls.close();
+ }
ErrorClassifier.ErrorType errorType = ErrorClassifier.classify(e);
throw new ClassifiedException("Failed to verify connection: " + e.getMessage(), e, errorType);
}
pools.put(connId, ds);
+ loaders.put(connId, loader);
+ if (tls != null) {
+ cqlTls.put(connId, tls);
+ }
}
/** Reuse one {@link DriverClassLoader} per set of driver JARs. */
@@ -174,6 +196,10 @@ public void disconnect(String connId) {
// The loader is shared with other connections (see sharedLoaders), so it is
// only closed when the whole bridge shuts down.
loaders.remove(connId);
+ SslPropertyMapper.CqlTlsSettings tls = cqlTls.remove(connId);
+ if (tls != null) {
+ tls.close();
+ }
}
/**
@@ -216,6 +242,8 @@ public void closeAll() {
ds.close();
}
pools.clear();
+ cqlTls.values().forEach(SslPropertyMapper.CqlTlsSettings::close);
+ cqlTls.clear();
for (DriverClassLoader loader : loaders.values()) {
try { loader.close(); } catch (Exception ignored) { }
}
diff --git a/jdbc-bridge/src/main/java/sqlkit/bridge/ProtocolHandler.java b/jdbc-bridge/src/main/java/sqlkit/bridge/ProtocolHandler.java
index e04896c2..f467be8c 100644
--- a/jdbc-bridge/src/main/java/sqlkit/bridge/ProtocolHandler.java
+++ b/jdbc-bridge/src/main/java/sqlkit/bridge/ProtocolHandler.java
@@ -45,6 +45,7 @@ public ObjectNode handle(JsonNode request) {
break;
case "connect":
+ case "connect_cql_tls":
handleConnect(params, response);
break;
diff --git a/jdbc-bridge/src/main/java/sqlkit/bridge/SslPropertyMapper.java b/jdbc-bridge/src/main/java/sqlkit/bridge/SslPropertyMapper.java
index 7503fe0f..aa097a04 100644
--- a/jdbc-bridge/src/main/java/sqlkit/bridge/SslPropertyMapper.java
+++ b/jdbc-bridge/src/main/java/sqlkit/bridge/SslPropertyMapper.java
@@ -1,6 +1,12 @@
package sqlkit.bridge;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
import java.io.*;
+import java.net.URI;
+import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.KeyStore;
@@ -10,9 +16,12 @@
import java.security.cert.X509Certificate;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Base64;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Properties;
public class SslPropertyMapper {
+ private static final ObjectMapper MAPPER = new ObjectMapper();
private static final String KEYSTORE_PASSWORD = "changeit";
public static void applySslProperties(String driverClass, String jdbcUrl,
@@ -124,6 +133,97 @@ public static void applySslProperties(String driverClass, String jdbcUrl,
}
}
+ static boolean requiresCqlTls(String driverClass, String mode) {
+ return "com.ing.data.cassandra.jdbc.CassandraDriver".equals(driverClass)
+ && ("require".equals(mode) || "verify-ca".equals(mode) || "verify-full".equals(mode));
+ }
+
+ /** Connection-local TLS settings for the Cassandra wrapper. */
+ static final class CqlTlsSettings implements AutoCloseable {
+ final Properties properties = new Properties();
+ private final List files = new ArrayList<>();
+
+ void addStore(ObjectNode ssl, String kind, String store) throws IOException {
+ if (store == null) {
+ throw new IOException("Could not load CQL TLS " + kind);
+ }
+ files.add(Path.of(store));
+ ssl.put(kind + "-path", store);
+ ssl.put(kind + "-password", KEYSTORE_PASSWORD);
+ }
+
+ @Override
+ public void close() {
+ for (Path file : files) {
+ try {
+ Files.deleteIfExists(file);
+ } catch (IOException e) {
+ file.toFile().deleteOnExit();
+ }
+ }
+ }
+ }
+
+ static CqlTlsSettings cqlTlsSettings(String url, String user, String password, String mode,
+ String ca, String cert, String key) throws IOException {
+ CqlTlsSettings tls = new CqlTlsSettings();
+ boolean verifyHostname = "verify-full".equals(mode);
+ if (ca == null && cert == null && key == null) {
+ tls.properties.setProperty("enableSsl", "true");
+ tls.properties.setProperty("hostnameVerification", Boolean.toString(verifyHostname));
+ return tls;
+ }
+ try {
+ if ((cert == null) != (key == null)) {
+ throw new IOException("CQL TLS client authentication requires both a certificate and a private key");
+ }
+ // A driver config file replaces the wrapper's programmatic settings.
+ // Include the original datacenter and credentials alongside the TLS stores.
+ String dc = null;
+ String query = URI.create(url.substring("jdbc:".length())).getQuery();
+ if (query != null) {
+ for (String param : query.split("&")) {
+ if (param.startsWith("localdatacenter=")) {
+ dc = URLDecoder.decode(param.substring("localdatacenter=".length()), StandardCharsets.UTF_8);
+ break;
+ }
+ }
+ }
+ if (dc == null || dc.isBlank()) {
+ throw new IOException("CQL TLS requires a local datacenter");
+ }
+
+ ObjectNode root = MAPPER.createObjectNode();
+ ObjectNode driver = root.putObject("datastax-java-driver");
+ driver.putObject("basic").putObject("load-balancing-policy").put("local-datacenter", dc);
+ ObjectNode advanced = driver.putObject("advanced");
+ if (user != null && !user.isEmpty() && password != null) {
+ ObjectNode auth = advanced.putObject("auth-provider");
+ auth.put("class", "PlainTextAuthProvider");
+ auth.put("username", user);
+ auth.put("password", password);
+ }
+ ObjectNode ssl = advanced.putObject("ssl-engine-factory");
+ ssl.put("class", "DefaultSslEngineFactory");
+ ssl.put("hostname-validation", verifyHostname);
+ if (ca != null) {
+ tls.addStore(ssl, "truststore", convertPemCaCertToPkcs12(ca));
+ }
+ if (cert != null) {
+ tls.addStore(ssl, "keystore", convertPemClientCertToPkcs12(cert, key));
+ }
+ Path configuration = Files.createTempFile("sqlkit-cql-tls-", ".conf");
+ tls.files.add(configuration);
+ configuration.toFile().deleteOnExit();
+ Files.writeString(configuration, root.toString());
+ tls.properties.setProperty("configFile", configuration.toString());
+ return tls;
+ } catch (IOException | RuntimeException e) {
+ tls.close();
+ throw e;
+ }
+ }
+
private static String convertPemCaCertToPkcs12(String pemPath) {
try {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
diff --git a/jdbc-bridge/src/test/java/sqlkit/bridge/SslPropertyMapperTest.java b/jdbc-bridge/src/test/java/sqlkit/bridge/SslPropertyMapperTest.java
index 9025111b..5dd3c270 100644
--- a/jdbc-bridge/src/test/java/sqlkit/bridge/SslPropertyMapperTest.java
+++ b/jdbc-bridge/src/test/java/sqlkit/bridge/SslPropertyMapperTest.java
@@ -35,6 +35,19 @@ void unknownDriversReceiveNoProperties() {
assertTrue(apply("com.example.UnknownDriver", "require").isEmpty());
}
+ @Test
+ void cqlRequiredModesEnableEncryptionAndUseTheRequestedHostnameCheck() throws Exception {
+ String url = "jdbc:cassandra://localhost:9042/system?localdatacenter=datacenter1";
+ assertTrue(SslPropertyMapper.requiresCqlTls("com.ing.data.cassandra.jdbc.CassandraDriver", "require"));
+ try (var require = SslPropertyMapper.cqlTlsSettings(url, "", null, "require", null, null, null);
+ var verify = SslPropertyMapper.cqlTlsSettings(url, "", null, "verify-full", null, null, null)) {
+ assertEquals("true", require.properties.getProperty("enableSsl"));
+ assertEquals("false", require.properties.getProperty("hostnameVerification"));
+ assertEquals("true", verify.properties.getProperty("enableSsl"));
+ assertEquals("true", verify.properties.getProperty("hostnameVerification"));
+ }
+ }
+
@Test
void knownDriversKeepTheirSslProperties() {
assertEquals("require", apply("org.postgresql.Driver", "require").getProperty("sslmode"));
diff --git a/src-tauri/src/commands/browse.rs b/src-tauri/src/commands/browse.rs
index 62b83215..6e245165 100644
--- a/src-tauri/src/commands/browse.rs
+++ b/src-tauri/src/commands/browse.rs
@@ -107,6 +107,10 @@ fn build_paginated_select(
.unwrap_or_default();
match db_type {
+ "cql" => format!(
+ "SELECT * FROM {qualified_table}{where_clause} LIMIT {}",
+ limit.max(1)
+ ),
"sqlserver" => format!(
"SELECT * FROM {}{} ORDER BY (SELECT NULL) OFFSET {} ROWS FETCH NEXT {} ROWS ONLY",
qualified_table, where_clause, offset, limit
@@ -363,6 +367,25 @@ async fn get_table_data_inner(
offset_val: u32,
db_type: &str,
) -> DbResult {
+ if let ActiveConnection::JdbcBridge(adapter) = connection {
+ let adapter = adapter.lock().await;
+ if adapter.config.db_type.is_cql() {
+ if offset_val != 0 {
+ return Err(crate::database::error::DbError::UnsupportedOperation(
+ "CQL does not support row offsets. Use a filtered query to browse more rows."
+ .into(),
+ ));
+ }
+ let keyspace = query
+ .schema
+ .as_deref()
+ .or(query.database.as_deref())
+ .unwrap_or_else(|| adapter.config.cql_keyspace());
+ let qualified = build_qualified_table(Some(keyspace), &query.table, db_type);
+ let sql = build_paginated_select(&qualified, filter_ref, limit_val, 0, "cql");
+ return adapter.execute_query(&sql).await;
+ }
+ }
let qualified = build_qualified_table(query.schema.as_deref(), &query.table, db_type);
let sql = build_paginated_select(&qualified, filter_ref, limit_val, offset_val, db_type);
@@ -451,6 +474,18 @@ async fn get_table_count_inner(
filter_ref: Option<&str>,
db_type: &str,
) -> DbResult {
+ if let ActiveConnection::JdbcBridge(adapter) = connection {
+ let adapter = adapter.lock().await;
+ if adapter.config.db_type.is_cql() {
+ let keyspace = schema
+ .or(database)
+ .unwrap_or_else(|| adapter.config.cql_keyspace());
+ let qualified = build_qualified_table(Some(keyspace), table, db_type);
+ return adapter
+ .execute_query(&build_count_query(&qualified, filter_ref))
+ .await;
+ }
+ }
let qualified = build_qualified_table(schema, table, db_type);
let query = build_count_query(&qualified, filter_ref);
@@ -1135,6 +1170,15 @@ mod tests {
assert!(query_with_filter.contains("OFFSET 5"));
}
+ #[test]
+ fn cql_preview_uses_a_limit_without_an_offset() {
+ let qualified = build_qualified_table(Some("events_keyspace"), "events", "jdbc");
+ assert_eq!(
+ build_paginated_select(&qualified, Some("id = 7"), 100, 0, "cql"),
+ "SELECT * FROM \"events_keyspace\".\"events\" WHERE id = 7 LIMIT 100"
+ );
+ }
+
#[test]
fn test_build_count_query() {
let query = build_count_query("\"table\"", None);
diff --git a/src-tauri/src/database/config.rs b/src-tauri/src/database/config.rs
index 15f2e568..10009f6b 100644
--- a/src-tauri/src/database/config.rs
+++ b/src-tauri/src/database/config.rs
@@ -162,6 +162,10 @@ pub enum DatabaseType {
}
impl DatabaseType {
+ pub(crate) fn is_cql(self) -> bool {
+ matches!(self, Self::Cassandra | Self::ScyllaDB)
+ }
+
/// Whether this connection type has an SSL/TLS concept at all.
///
/// Embedded / file-based engines mirror the frontend
@@ -346,10 +350,38 @@ impl ConnectionConfig {
/// Set the database name.
pub fn with_database(mut self, database: impl Into) -> Self {
- self.database = Some(database.into());
+ let database = database.into();
+ if self.db_type.is_cql() {
+ // Older connection records store the datacenter in the database value.
+ let (keyspace, params) = database.split_once('?').unwrap_or((&database, ""));
+ if let Some((_, dc)) = url::form_urlencoded::parse(params.as_bytes())
+ .find(|(name, _)| name.eq_ignore_ascii_case("localdatacenter"))
+ {
+ self.options
+ .insert("localdatacenter".into(), dc.into_owned());
+ }
+ self.database = Some(keyspace.trim().to_string());
+ } else {
+ self.database = Some(database);
+ }
self
}
+ pub(crate) fn cql_keyspace(&self) -> &str {
+ self.database
+ .as_deref()
+ .filter(|name| !name.is_empty())
+ .unwrap_or("system")
+ }
+
+ pub(crate) fn cql_datacenter(&self) -> &str {
+ self.options
+ .get("localdatacenter")
+ .map(|dc| dc.trim())
+ .filter(|dc| !dc.is_empty())
+ .unwrap_or("datacenter1")
+ }
+
/// Set the password.
pub fn with_password(mut self, password: impl Into) -> Self {
self.password = Some(password.into());
diff --git a/src-tauri/src/database/jdbc_bridge/adapter.rs b/src-tauri/src/database/jdbc_bridge/adapter.rs
index dd266f1f..83d72285 100644
--- a/src-tauri/src/database/jdbc_bridge/adapter.rs
+++ b/src-tauri/src/database/jdbc_bridge/adapter.rs
@@ -38,22 +38,12 @@ impl JdbcBridgeAdapter {
}
}
- /// CQL stores (Cassandra/ScyllaDB) via the wrapper driver: the wrapper maps
- /// keyspaces to JDBC schemas, not catalogs — its catalog lookup returns
- /// nothing, so metadata RPCs must carry the keyspace in the schema slot.
- fn is_cql(&self) -> bool {
- matches!(
- self.config.db_type,
- DatabaseType::Cassandra | DatabaseType::ScyllaDB
- )
- }
-
fn fold_catalog_into_schema<'a>(
&self,
database: Option<&'a str>,
schema: Option<&'a str>,
) -> (Option<&'a str>, Option<&'a str>) {
- if self.is_cql() {
+ if self.config.db_type.is_cql() {
(None, schema.or(database))
} else {
(database, schema)
@@ -101,11 +91,32 @@ impl JdbcBridgeAdapter {
// Use fallback chain for JDBC-dependent databases (Oracle, DB2, H2, etc.)
// For non-registry types, fall back to the old single-driver approach
+ let cql_database = if db_type.is_cql() {
+ let keyspace = self.config.cql_keyspace();
+ if !keyspace.starts_with(|c: char| c.is_ascii_alphabetic())
+ || !keyspace
+ .bytes()
+ .all(|c| c.is_ascii_alphanumeric() || c == b'_')
+ {
+ return Err(DbError::Connection(format!(
+ "Invalid CQL keyspace: {keyspace}"
+ )));
+ }
+ // The wrapper decodes the URI query and then decodes each parameter.
+ let encoded_dc =
+ url::form_urlencoded::byte_serialize(self.config.cql_datacenter().as_bytes())
+ .collect::();
+ let dc =
+ url::form_urlencoded::byte_serialize(encoded_dc.as_bytes()).collect::();
+ Some(format!("{keyspace}?localdatacenter={dc}"))
+ } else {
+ None
+ };
let (_version, conn_id, launcher) = super::fallback::run_fallback_chain(
db_type,
&self.config.host,
self.config.port,
- self.config.database.as_deref(),
+ cql_database.as_deref().or(self.config.database.as_deref()),
&self.config.username,
&self.config.password,
self.config.oracle_options.as_ref(),
@@ -260,7 +271,24 @@ impl DatabaseAdapter for JdbcBridgeAdapter {
),
)
.await?;
- Self::parse_connection_status(data)
+ let mut status = Self::parse_connection_status(data)?;
+ if self.config.db_type.is_cql() {
+ if self.config.db_type == DatabaseType::Cassandra
+ && status
+ .server_version
+ .as_deref()
+ .and_then(|version| version.split('.').next())
+ .and_then(|major| major.parse::().ok())
+ .is_some_and(|major| major < 3)
+ {
+ return Err(DbError::UnsupportedOperation(
+ "Cassandra 3.0 or later is required for keyspace and table browsing.".into(),
+ ));
+ }
+ // JDBC getCatalog() exposes the cluster name for the CQL wrapper.
+ status.current_database = Some(self.config.cql_keyspace().to_string());
+ }
+ Ok(status)
}
async fn execute_query(&self, query: &str) -> DbResult {
@@ -332,7 +360,7 @@ impl DatabaseAdapter for JdbcBridgeAdapter {
}
async fn list_databases(&self) -> DbResult> {
- if self.is_cql() {
+ if self.config.db_type.is_cql() {
// The wrapper's catalog listing reports the cluster name, not
// keyspaces — read them from system_schema instead.
return Ok(self
@@ -373,7 +401,7 @@ impl DatabaseAdapter for JdbcBridgeAdapter {
}
async fn list_schemas(&self, database: Option<&str>) -> DbResult> {
- let (database, schema) = if self.is_cql() {
+ let (database, schema) = if self.config.db_type.is_cql() {
// The wrapper reports keyspaces as schemas — carry the database there.
(None, database)
} else {
@@ -401,7 +429,7 @@ impl DatabaseAdapter for JdbcBridgeAdapter {
database: Option<&str>,
schema: Option<&str>,
) -> DbResult> {
- if self.is_cql() {
+ if self.config.db_type.is_cql() {
// The wrapper's DatabaseMetaData only reports objects of the
// keyspace bound at connect time and ignores the catalog/schema
// arguments — so browsing a keyspace picked later in the UI would
@@ -478,12 +506,12 @@ impl DatabaseAdapter for JdbcBridgeAdapter {
schema: Option<&str>,
table: &str,
) -> DbResult> {
- if self.is_cql() {
+ if self.config.db_type.is_cql() {
// Same session-keyspace limitation as list_tables: read the column
// definitions (and primary-key flags) from system_schema.
- let Some(keyspace) = schema.or(database) else {
- return Ok(Vec::new());
- };
+ let keyspace = schema
+ .or(database)
+ .unwrap_or_else(|| self.config.cql_keyspace());
let sql = format!(
"SELECT column_name, kind, position, type FROM system_schema.columns \
WHERE keyspace_name = '{}' AND table_name = '{}'",
@@ -496,9 +524,19 @@ impl DatabaseAdapter for JdbcBridgeAdapter {
.iter()
.filter_map(|row| {
let name = row.get("column_name").and_then(|v| v.as_string())?;
- let kind = row.get("kind").and_then(|v| v.as_string()).unwrap_or_default();
- let ty = row.get("type").and_then(|v| v.as_string()).unwrap_or_default();
- Some((name, kind.contains("partition_key") || kind.contains("clustering"), ty))
+ let kind = row
+ .get("kind")
+ .and_then(|v| v.as_string())
+ .unwrap_or_default();
+ let ty = row
+ .get("type")
+ .and_then(|v| v.as_string())
+ .unwrap_or_default();
+ Some((
+ name,
+ kind.contains("partition_key") || kind.contains("clustering"),
+ ty,
+ ))
})
.collect();
// Primary-key columns first, then the rest, mirroring CQL's layout.
diff --git a/src-tauri/src/database/jdbc_bridge/drivers.toml b/src-tauri/src/database/jdbc_bridge/drivers.toml
index ae052f43..ca4ad4ed 100644
--- a/src-tauri/src/database/jdbc_bridge/drivers.toml
+++ b/src-tauri/src/database/jdbc_bridge/drivers.toml
@@ -309,8 +309,8 @@ version_error_signatures = [ "driver version not compatible", ]
# Cassandra java-driver 4.x and speaks plain `jdbc:cassandra://` URLs.
# Maven Central only hosts the thin JAR, so we download the pre-shaded
# "bundle" JAR (all deps included) from the wrapper's GitHub releases —
-# same direct-download flow as GBase 8a. The bundle supports
-# Cassandra 2.1–4.x, DSE and ScyllaDB.
+# same direct-download flow as GBase 8a. SQLKit uses system_schema for
+# metadata and supports Cassandra 3.0 and later and ScyllaDB.
[databases.cassandra]
name = "Apache Cassandra"
diff --git a/src-tauri/src/database/jdbc_bridge/fallback.rs b/src-tauri/src/database/jdbc_bridge/fallback.rs
index 690db0d6..920f6adb 100644
--- a/src-tauri/src/database/jdbc_bridge/fallback.rs
+++ b/src-tauri/src/database/jdbc_bridge/fallback.rs
@@ -286,7 +286,15 @@ async fn connect_with_jar(
}
};
- let req = JdbcRequest::new(JdbcMethod::Connect, params);
+ // An older bridge would ignore CQL's SSL settings on a standard Connect.
+ let cql_tls = db_type_from_config(config).is_cql()
+ && matches!(ssl_mode, Some("require" | "verify-ca" | "verify-full"));
+ let method = if cql_tls {
+ JdbcMethod::ConnectCqlTls
+ } else {
+ JdbcMethod::Connect
+ };
+ let req = JdbcRequest::new(method, params);
// 30s timeout per attempt
let conn_result = tokio::time::timeout(std::time::Duration::from_secs(30), async {
@@ -298,6 +306,11 @@ async fn connect_with_jar(
match conn_result {
Ok(Ok(resp)) => {
if let Some(ref err) = resp.error {
+ if cql_tls && err.starts_with("Unknown method") {
+ return DriverAttempt::Fatal(DbError::Connection(
+ "The installed JDBC bridge does not support Cassandra or ScyllaDB TLS. Update the bridge in Settings → JRE & Drivers.".into(),
+ ));
+ }
let category = classify_connection_error(
db_type_from_config(config),
err,
@@ -492,7 +505,6 @@ pub async fn run_fallback_chain(
}
}
-
fn db_type_from_config(config: &DatabaseDriverConfig) -> DatabaseType {
match config.name.as_str() {
"Oracle Database" => DatabaseType::Oracle,
diff --git a/src-tauri/src/database/jdbc_bridge/protocol.rs b/src-tauri/src/database/jdbc_bridge/protocol.rs
index 71520679..86b9a8a4 100644
--- a/src-tauri/src/database/jdbc_bridge/protocol.rs
+++ b/src-tauri/src/database/jdbc_bridge/protocol.rs
@@ -11,6 +11,7 @@ use serde::{Deserialize, Serialize};
#[serde(rename_all = "snake_case")]
pub enum JdbcMethod {
Connect,
+ ConnectCqlTls,
Disconnect,
ExecuteQuery,
ListDatabases,
diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rs
index f212fd09..c8562689 100644
--- a/src-tauri/src/state.rs
+++ b/src-tauri/src/state.rs
@@ -243,6 +243,13 @@ impl ServerConfig {
crate::database::config::duckdb_database_value(&self.host, self.read_only)
.map_err(|e| format!("Invalid DuckDB database path: {}", e))?;
config = config.with_database(database);
+ } else if db_type.is_cql() {
+ config = config.with_database(
+ self.database
+ .as_deref()
+ .filter(|name| !name.trim().is_empty())
+ .unwrap_or("system"),
+ );
} else if let Some(ref database) = self.database {
config = config.with_database(database);
}
@@ -567,6 +574,27 @@ mod tests {
assert!(reopened.prompt.is_none());
}
+ #[test]
+ fn cql_split_keeps_the_local_datacenter_on_a_keyspace_switch() {
+ for db_type in ["cassandra", "scylladb"] {
+ let mut server = ServerConfig::new(
+ "CQL".into(),
+ db_type.into(),
+ "127.0.0.1".into(),
+ 9042,
+ "".into(),
+ );
+ server.database = Some("system?localdatacenter=dc%2Bwest".into());
+ let mut config = server.to_connection_config().unwrap();
+ assert_eq!(config.cql_keyspace(), "system");
+ assert_eq!(config.cql_datacenter(), "dc+west");
+
+ config.database = Some("events".into());
+ assert_eq!(config.cql_keyspace(), "events");
+ assert_eq!(config.cql_datacenter(), "dc+west");
+ }
+ }
+
#[test]
fn duckdb_maps_the_file_path_into_the_database_field() {
let config = file_config("duckdb", "/tmp/analytics.duckdb", false)
diff --git a/src/__tests__/dataTablePagination.test.ts b/src/__tests__/dataTablePagination.test.ts
index ad49dfd1..dfeec640 100644
--- a/src/__tests__/dataTablePagination.test.ts
+++ b/src/__tests__/dataTablePagination.test.ts
@@ -8,7 +8,7 @@ jest.mock('@tauri-apps/plugin-dialog', () => ({ save: jest.fn() }))
jest.mock('@/components/pagination', () => ({
PaginationControls: {
name: 'PaginationControls',
- props: { currentPage: Number, pageCount: Number, pageSize: [Number, String], disabled: Boolean, allowAll: Boolean },
+ props: { currentPage: Number, pageCount: Number, pageSize: [Number, String], disabled: Boolean, allowAll: Boolean, preview: Boolean },
template: '',
},
}))
@@ -20,9 +20,15 @@ jest.mock('@/components/ui/destructive-confirm-dialog', () => ({ DestructiveConf
jest.mock('@/components/ui/dialog', () => Object.fromEntries(
['Dialog', 'DialogContent', 'DialogTitle'].map(name => [name, { template: '
' }]),
))
+let mockDbType = 'POSTGRESQL'
+
jest.mock('@/store', () => ({
ConnectionStatus: { CONNECTED: 'connected' },
- useConnectionStore: () => ({ getConnectionStatus: () => 'connected' }),
+ DatabaseType: { CASSANDRA: 'CASSANDRA', SCYLLADB: 'SCYLLADB' },
+ useConnectionStore: () => ({
+ getConnectionStatus: () => 'connected',
+ getConnectionById: () => ({ type: mockDbType }),
+ }),
}))
jest.mock('@/composables/useMinLoadingTime', () => ({
useMinLoadingTime: () => ({ withMinLoadingTime: (operation: () => Promise) => operation() }),
@@ -43,6 +49,7 @@ const mountTable = () => shallowMount(DataTableView, {
const lastQuery = () => mockInvoke.mock.calls.filter(([command]) => command === 'get_table_data').slice(-1)[0][1].query
beforeEach(() => {
+ mockDbType = 'POSTGRESQL'
total = 235
mockInvoke.mockReset().mockImplementation(async (command, args) => {
if (command === 'get_table_count')
@@ -60,6 +67,22 @@ beforeEach(() => {
})
describe('table browsing with shared pagination', () => {
+ it.each(['CASSANDRA', 'SCYLLADB'])('shows a bounded preview for %s', async (dbType) => {
+ mockDbType = dbType
+ const wrapper = mountTable()
+ await flushPromises()
+ const controls = wrapper.findComponent({ name: 'PaginationControls' })
+ expect(controls.props('preview')).toBe(true)
+ expect(lastQuery()).toMatchObject({ limit: 100, offset: 0 })
+ expect(mockInvoke.mock.calls.map(([command]) => command)).not.toContain('get_table_count')
+ expect(wrapper.get('[role="status"]').text()).toContain('components.dataTableView.previewRows {"count":100}')
+ controls.vm.$emit('pageChange', 2)
+ controls.vm.$emit('pageSizeChange', 25)
+ await flushPromises()
+ expect(lastQuery()).toMatchObject({ limit: 25, offset: 0 })
+ expect(mockInvoke.mock.calls.filter(([command]) => command === 'get_table_data')).toHaveLength(2)
+ wrapper.unmount()
+ })
it('keeps returned rows visible without claiming a total when the count fails', async () => {
const normalInvoke = mockInvoke.getMockImplementation()!
mockInvoke.mockImplementation((command, args) => command === 'get_table_count'
diff --git a/src/components/connections/ServerFormDialog.vue b/src/components/connections/ServerFormDialog.vue
index 867e678d..111c87b8 100644
--- a/src/components/connections/ServerFormDialog.vue
+++ b/src/components/connections/ServerFormDialog.vue
@@ -151,18 +151,16 @@ const databaseWithLocalDc = () => {
return formData.value.database
const keyspace = formData.value.database?.trim() || 'system'
const dc = localDatacenter.value.trim() || 'datacenter1'
- return `${keyspace}?localdatacenter=${dc}`
+ return `${keyspace}?localdatacenter=${encodeURIComponent(dc)}`
}
const splitLocalDatacenter = (database?: string) => {
- if (!isCassandraFamily.value || !database?.includes('localdatacenter='))
+ if (!isCassandraFamily.value || !database)
return
const [keyspace, query = ''] = database.split('?')
- const param = query.split('&').find(p => p.startsWith('localdatacenter='))
- if (param) {
- localDatacenter.value = param.slice('localdatacenter='.length) || 'datacenter1'
- formData.value.database = keyspace
- }
+ const dc = [...new URLSearchParams(query)].find(([key]) => key.toLowerCase() === 'localdatacenter')
+ localDatacenter.value = dc?.[1] || 'datacenter1'
+ formData.value.database = keyspace
}
const testStatus = ref<'idle' | 'testing' | 'success' | 'error'>('idle')
const testError = ref('')
@@ -254,6 +252,7 @@ const { platform } = usePlatform()
watch(() => props.open, (open) => {
if (open) {
+ localDatacenter.value = 'datacenter1'
if (props.connection) {
formData.value = { ...props.connection }
splitLocalDatacenter(formData.value.database)
diff --git a/src/components/database-browser/DataTableView.vue b/src/components/database-browser/DataTableView.vue
index a4a4fbe7..ef92f5ea 100644
--- a/src/components/database-browser/DataTableView.vue
+++ b/src/components/database-browser/DataTableView.vue
@@ -17,7 +17,7 @@ import { useDataGridSort } from '@/composables/useDataGridSort'
import { useMinLoadingTime } from '@/composables/useMinLoadingTime'
import { toast } from '@/composables/useNotifications'
import { useTableSearch } from '@/composables/useTableSearch'
-import { ConnectionStatus, useConnectionStore } from '@/store'
+import { ConnectionStatus, DatabaseType, useConnectionStore } from '@/store'
import { collectSortableColumns, sortRowsByState } from '@/utils/gridSort'
import {
formatTableValue,
@@ -132,6 +132,10 @@ const invalidated = ref(false)
// --- Connection state ---
const connectionStore = useConnectionStore()
+const isCqlPreview = computed(() => {
+ const type = connectionStore.getConnectionById(props.connectionId)?.type
+ return type === DatabaseType.CASSANDRA || type === DatabaseType.SCYLLADB
+})
const isReconnecting = ref(false)
const connectionError = ref(null)
@@ -250,6 +254,8 @@ function formatPkSummary(row: Record): string {
const pageStatus = computed(() => {
const count = data.value?.rows.length ?? 0
+ if (isCqlPreview.value)
+ return t('components.dataTableView.previewRows', { count })
if (!countAvailable.value)
return t('components.pagination.showingWithoutTotal', { start: count > 0 ? offset.value + 1 : 0, end: offset.value + count })
return t('components.dataGrid.status.showing', {
@@ -284,7 +290,7 @@ async function fetchData() {
schema: props.schema ?? null,
filter: appliedFilter.value.trim() || null,
limit: rowsPerPage.value,
- offset: offset.value,
+ offset: isCqlPreview.value ? 0 : offset.value,
},
})
data.value = result
@@ -352,7 +358,8 @@ async function ensureConnection(): Promise {
}
async function refresh() {
- await fetchCount()
+ if (!isCqlPreview.value)
+ await fetchCount()
await fetchData()
}
@@ -500,7 +507,7 @@ function onGlobalKeydown(e: KeyboardEvent) {
}
const goToPage = (page: number) => {
- if (loading.value || countLoading.value || !Number.isSafeInteger(page) || page === currentPage.value)
+ if (isCqlPreview.value || loading.value || countLoading.value || !Number.isSafeInteger(page) || page === currentPage.value)
return
setPage(page)
fetchData()
@@ -1251,6 +1258,7 @@ watch(
:current-page="currentPage"
:page-count="totalPages"
:page-size="rowsPerPage"
+ :preview="isCqlPreview"
:max-page-size="MAX_FETCH_PAGE_SIZE"
:database="props.database"
:disabled="loading || countLoading || isReconnecting || !!connectionError || !!error"
diff --git a/src/components/pagination/PaginationControls.vue b/src/components/pagination/PaginationControls.vue
index f1dea58e..cfcc2b98 100644
--- a/src/components/pagination/PaginationControls.vue
+++ b/src/components/pagination/PaginationControls.vue
@@ -18,6 +18,7 @@ const props = withDefaults(defineProps<{
pageCount: number
pageSize: PageSize
disabled?: boolean
+ preview?: boolean
allowAll?: boolean
maxPageSize?: number
database?: string
@@ -35,12 +36,14 @@ const pageSizeLabel = computed(() => props.pageSize === 'all'
? t('components.pagination.allRows')
: t('components.pagination.pageSize', { count: props.pageSize }))
const validCustomSize = computed(() => isValidPageSize(Number(customSize.value), false, props.maxPageSize))
-const navigation = computed(() => [
- { label: 'firstPage', icon: 'i-lucide-chevrons-left', page: 1, disabled: props.currentPage <= 1 },
- { label: 'previousPage', icon: 'i-lucide-chevron-left', page: props.currentPage - 1, disabled: props.currentPage <= 1 },
- { label: 'nextPage', icon: 'i-lucide-chevron-right', page: props.currentPage + 1, disabled: props.currentPage >= props.pageCount },
- { label: 'lastPage', icon: 'i-lucide-chevrons-right', page: props.pageCount, disabled: props.currentPage >= props.pageCount },
-])
+const navigation = computed(() => props.preview
+ ? []
+ : [
+ { label: 'firstPage', icon: 'i-lucide-chevrons-left', page: 1, disabled: props.currentPage <= 1 },
+ { label: 'previousPage', icon: 'i-lucide-chevron-left', page: props.currentPage - 1, disabled: props.currentPage <= 1 },
+ { label: 'nextPage', icon: 'i-lucide-chevron-right', page: props.currentPage + 1, disabled: props.currentPage >= props.pageCount },
+ { label: 'lastPage', icon: 'i-lucide-chevrons-right', page: props.pageCount, disabled: props.currentPage >= props.pageCount },
+ ])
watch(() => [props.currentPage, props.pageCount, props.disabled], () => {
pageInput.value = String(props.currentPage)
@@ -78,7 +81,7 @@ const applyCustomSize = () => {
-