Skip to content

Report the JDBC URL from DatabaseMetaData.getURL() instead of the transport endpoint #274

Closed

Description

@magnusp

Problem

LibsqlDatabaseMetaData.getURL() returns connection.getConfig().url(), which is the
transport endpoint, not the JDBC URL the caller used. DatabaseMetaData.getURL() is
specified to return the URL for the database, so this loses the jdbc: scheme and the
prefix.

Current values:

  • jdbc:libsql:http://host:port → getURL() returns http://host:port
  • jdbc:sqlite:http://host:port → getURL() returns http://host:port
  • WebSocket connections → ws://... or wss://...

WebSocketTransportIT#metadataAndBatchWorkOverWebSocket pins the endpoint value.

Why it matters

URL-based consumers cannot recognize the database. jOOQ 3.21's
JDBCUtils.dialect(Connection) reads DatabaseMetaData.getURL() and matches known JDBC
prefixes. The endpoint has no jdbc:... prefix, so jOOQ returns SQLDialect.DEFAULT
even for a jdbc:sqlite: connection. JooqIT#dialectDetectionUsesTheUrlNotTheProductName
currently pins that fallback.

With the original JDBC URL, jOOQ would select SQLDialect.SQLITE for the
jdbc:sqlite: alias. jdbc:libsql: would still need an explicit dialect because jOOQ
has no libsql prefix; that is acceptable and already documented.

Where

  • libsql-jdbc/src/main/java/io/github/magnusp/libsql/jdbc/LibsqlDatabaseMetaData.java:191
  • libsql-jdbc/src/main/java/io/github/magnusp/libsql/jdbc/LibsqlDriver.java:34 knows
    the original URL and can pass it to LibsqlConnection.
  • libsql-itests/src/test/java/io/github/magnusp/libsql/itest/WebSocketTransportIT.java:111
    pins the current endpoint value.

Fix

Preserve the URL passed to LibsqlDriver.connect on LibsqlConnection and return it
from LibsqlDatabaseMetaData.getURL(). Keep config.url() for the transport.

Verification

  • Unit test getURL() for jdbc:libsql: and jdbc:sqlite: over HTTP.
  • Update WebSocketTransportIT to expect the jdbc:libsql: URL.
  • JooqIT: alias connection → SQLDialect.SQLITE; jdbc:libsql: → SQLDialect.DEFAULT.
  • ./mvnw -pl libsql-jdbc -am verify and ./mvnw spotless:check.

Found while correcting the jOOQ dialect pin in #261/#268.

Activity

  1. added
    bugSomething isn't working
    P2Normal priority: edge case, feature gap, or test/process improvement
    on Oct 31, 2026
  2. magnusp commented on Oct 31, 2026

    @magnusp
    OwnerAuthor

    Folded into #268. getURL() now preserves the JDBC URL (credential query parameters and user info redacted), and JooqIT detects SQLDialect.SQLITE for a jdbc:sqlite: connection. The PR closes this issue on merge.

  3. magnusp commented on Oct 31, 2026

    @magnusp
    OwnerAuthor

    Fixed by #268, merged in bda077b: getURL() preserves the JDBC URL (credentials redacted), and JooqIT detects SQLDialect.SQLITE for a jdbc:sqlite: connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority: edge case, feature gap, or test/process improvementbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions