如何在SQLite中使用SchemaSpy?

huangapple 未分类评论57阅读模式
英文:

How to use SchemaSpy with SQLite?

问题

使用SchemaSpy创建SQLite数据库的ERD,我正在尝试使用chinook.db示例数据库。

使用以下命令:

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

我获得以下部分输出:

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

我不明白"Read-only"是什么意思,因为这在我Mac上自己的目录中执行。

我已经下载了最新的SQLite JDBC驱动程序,并尝试了以下命令行:

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

但系统以以下方式响应:

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
英文:

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

得分: 0

第一个只读错误可能是因为它尝试在根目录中创建数据库。数据库路径是绝对路径。

我不确定是哪个版本的SchemaSpy,但是 -t sqlite-xerial 已经添加了用于 xerial 驱动程序。

而且似乎 -dp 参数没有指向驱动程序,或者没有正确解析它。

但是作为一个示例,将所有内容放在 /chinook 目录中(包括 schemaspy、xerial JDBC 驱动程序、数据库),然后从该目录运行命令,应该是这样的:

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

如果仍然有任何问题,请在 GitHub 上创建一个问题。

英文:

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.

huangapple
  • 本文由 发表于 2020年6月29日 02:10:12
  • 转载请务必保留本文链接:https://java.coder-hub.com/62626447.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定