Repository navigation
Closed
Labels
P2Normal priority: edge case, feature gap, or test/process improvementNormal priority: edge case, feature gap, or test/process improvementdocumentationImprovements or additions to documentationImprovements or additions to documentation
Description
Goal
Document, and cover with a test, how to point Liquibase at a jdbc:libsql:http(s)://... URL: pass the driver class explicitly (io.github.magnusp.libsql.jdbc.LibsqlDriver) or hand Liquibase a DataSource.
Why
Liquibase resolves a JDBC driver class from the URL before it opens a connection. DatabaseFactory.findDefaultDriver only consults registered liquibase.database.Database implementations, and SQLiteDatabase.getDefaultDriver claims only:
jdbc:sqlite:->org.sqlite.JDBC
So:
DatabaseFactory.openDatabase("jdbc:libsql:http://...")fails withDriver class was not specified and could not be determined from the url (jdbc:libsql:...).- The
jdbc:sqlite:alias resolves to xerial's driver class, which is not on the classpath (and would open a local file, not sqld).
This is not fixable inside the driver, because Liquibase never asks DriverManager which driver accepts the URL. It is a configuration and documentation gap. Pinned by LiquibaseIT#databaseFactoryCannotResolveALibsqlUrlToADriver in #257.
Workarounds that work today
- API:
new JdbcConnection(DriverManager.getConnection(url))plusnew SQLiteDatabase(). TheSQLiteDatabasepart disappears once the product-name issue is fixed. - Liquibase Maven plugin or
liquibase.properties: set the driver class,driver=io.github.magnusp.libsql.jdbc.LibsqlDriver. - Spring Boot or any pool: pass a
DataSourceand setspring.datasource.driver-class-name=io.github.magnusp.libsql.jdbc.LibsqlDriver.
Where
- Add a Liquibase section to
docs/(or extendREADME.md) with the three configurations above. - Add a positive
LiquibaseITcase that usesDatabaseFactory.openDatabase(url, null, null, LibsqlDriver.class.getName(), null)and asserts the result is aSQLiteDatabase. This depends on Report database product name as exactly SQLite so dialect detection works #261. - Keep the negative pin until then.
Verification
- The documented snippets run against the pinned sqld container.
./mvnw -pl libsql-jdbc -am verify -Dit.test=LiquibaseIT./mvnw spotless:check
Found while adding the Liquibase integration tests in #257.
Metadata
Metadata
Assignees
Labels
P2Normal priority: edge case, feature gap, or test/process improvementNormal priority: edge case, feature gap, or test/process improvementdocumentationImprovements or additions to documentationImprovements or additions to documentation
Activity
test(jdbc): add Liquibase integration smoke tests (#257)
docs: document the Liquibase bootstrap for libSQL (#269)