dbptk-developer icon indicating copy to clipboard operation
dbptk-developer copied to clipboard

JDBC driver does not work with SQLite database

Open cjwomack opened this issue 2 years ago • 12 comments

Description: The JDBC driver does not work with SQLite database due to the fact a SQLite file has only 1 database in each file ever and is unnamed and it is referred to as main when connected (As far as I can tell) See stackoverflow re this

"Error Message: ERROR Fatal error while converting the database (Error while exporting structure: dbname cannot be blank)" ...

This fact that this database is unnamed can be seen in the JDBC SQLite driver in the getCatalog() function (https://github.com/xerial/sqlite-jdbc/blob/ada2b147dc858ef557a995e2f4ef25f7c65fc6a7/src/main/java/org/sqlite/jdbc3/JDBC3Connection.java#L27)

The relevant line in the code referring to getCatalog() is getDatabaseName() function

Steps required to reproduce the bug:

  1. Get a SQLite DB (such as Chinook DB from www.sqlitetutorial.net) and JDBC driver for SQLite
  2. For Windows use: java "-Dfile.encoding=UTF-8" -cp "C:\path\to\dbptk-app-x.y.z.jar;C:\path\to\sqlite-jdbc-3.36.0.3.jar" com.databasepreservation.Main migrate --import=jdbc --import-driver=org.sqlite.JDBC --import-connection="jdbc:sqlite:C:\path\to\database" -e siard-2 -ef C:\path\to\output.siard

Adjust for other operating systems accordingly.

So it looks like the JDBC driver needs to be modified or a specific SQLite driver based off the JDBC driver.

Attach the dbptk-app.log.txt file below. dbptk-app.log.txt

cjwomack avatar May 24 '22 10:05 cjwomack