How to use SchemaSpy with SQLite?

639 Views Asked by At

How to use SchemaSpy to create an ERD of an SQLite database? I'm trying this with the chinook.db sample database.

Using this command:

java -jar schemaspy-6.1.0.jar -t sqlite -db chinook.db -u admin -o .

I get this partial output:

INFO  - The following profiles are active: default
INFO  - Started Main in 0.937 seconds (JVM running for 1.232)
INFO  - Starting schema analysis
WARN  - Connection Failure
Failed to connect to database URL [jdbc:sqlite:/chinook.db] opening db: '/chinook.db': Read-only file system
INFO  - StackTraces have been omitted, use `-debug` when executing SchemaSpy to see them

I don't understand what Read-only is trying to tell me as this is executed in a directory of my own on my Mac.

I've downloaded the latest SQLite JDBC driver and tried this command line:

java -jar schemaspy-6.1.0.jar -t sqlite -dp sqlite-jdbc-3.30.1.jar -db chinook.db -u admin -o .

And the system responds this way:

INFO  - The following profiles are active: default
INFO  - Started Main in 0.706 seconds (JVM running for 0.996)
INFO  - Starting schema analysis
WARN  - Connection Failure
Failed to connect to database URL [jdbc:sqlite:/chinook.db] Failed to create any of 'org.sqlite.JDBC' driver from driverPath 'sqlite-jdbc-3.30.1.jar' with sibling jars no.
Resulting in classpath: empty
There were missing paths in driverPath:
    sqlite-jdbc-3.30.1.jar
Use commandline option '-dp' to specify driver location.
If you need to load sibling jars used '-loadjars'
INFO  - StackTraces have been omitted, use `-debug` when executing SchemaSpy to see them
sd
1

There are 1 best solutions below

0
Nils Petzäll On

The first error read-only probably is because it tries to create a database in root. Path to db is absolut

I don't know exactly which version of SchemaSpy, but -t sqlite-xerial has been added for the xerial driver.

And it seems that the -dp argument didn't point to the driver or that it wasn't resolved correctly.

But as an example having everything in /chinook (schemaspy, xerial JDBC driver, database) and running from that directory the command should look something like

java -jar schemaspy-6.2.2.jar -dp /chinook/sqlite-jdbc-3.30.1.jar -t sqlite-xerial -db /chinook/chinook.db -sso -s chinook -cat chinook -o implied -o report

If there's still any issues please create an issue at GitHub.