Repository: schemaspy/schemaspy

Issue #524: SQLite connection failure (worked fine in SchemaSpy5.0.0)
Created: 2019-03-08T07:16:43Z
I was able to connect to my database and run SchemaSpy fine in the 5.0.0 version. Now I am getting WARN  - Connection Failure in 6.0.0.
This is the sqlite.properties file content:
description=SQLite
connectionSpec=jdbc:sqlite:<db>
db=students.db
driver=org.sqlite.JDBC
driverPath=sqlite-jdbc-3.23.1.jar
selectTablesSql=.tables

This is the entry in command prompt:
java -jar schemaspy-6.0.0.jar -t sqlite -db students.db -sso -dp C:\Users\name\Desktop\schemaspy3\schemaspy-6.0.0.jar -o C:\Users\name\Desktop\schemaspy3
This is the output:
INFO  - Starting Main v6.0.0 on DESKTOP-E0JS54C with PID 21508 (C:\Users\name\Desktop\schemaspy3\schemaspy-6.0.0.jar started by name in C:\Users\name\Desktop\schemaspy3)
INFO  - The following profiles are active: default
INFO  - Started Main in 3.0 seconds (JVM running for 3.942)
INFO  - Configuration file not found
INFO  - Starting schema analysis
WARN  - Connection Failure

Both schemaspy-6.0.0.jar and sqlite-jdbc-3.23.1.jar are in the same folder (C:\Users\name\Desktop\schemaspy3)

Duplicate issue #624: SQLIte connection error - Doesn't find sqlite.jar in install dir
Created: 2019-11-07T15:36:05Z
Creates correct path - the jar really is there - sqlite-jdbc-3.27.2.1.jar renamed to sqlite.jar
Expected Behavior

Expect it to find jar - or actually, to recognize jar - because jar is there and code is looking in right place

Current Behavior

Not recognizing sqlite.jar

Possible Solution


Steps to Reproduce (for bugs)


Setup attached schemaspy.properties

mkdir schemaspy
cd schemaspy
cp ~/Downloads/schemaspy-6.1.0.jar .
cp ~/Downloads/sqlite-jdbc-3.27.2.1.jar sqlite.jar
mkdir Wrk
cd Wrk
cp  .
cd ..
java -jar schemaspy-6.1.0.jar

Context




Database type (e.g. MySQL):
Database driver version (is you use a special one):
Your DDL (sample how to reproduce the issue):
Full command including arguments how you run SchemaSpy:

Your Environment


Version used: 6.1.0
Environment name and version (e.g. Chrome 39): ?????
Operating System and version (e.g. Windows 10): Ubuntu 18.04 in crouton
Java version: openjdk version "1.8.0_232"
OpenJDK Runtime Environment (Zulu 8.42.0.21-CA-linux64) (build 1.8.0_232-b18)
OpenJDK 64-Bit Server VM (Zulu 8.42.0.21-CA-linux64) (build 25.232-b18, mixed mode)

schemaspy.properties
# type of database. Run with -dbhelp for details
schemaspy.t=sqlite
# optional path to alternative jdbc drivers.
# schemaspy.dp=sqlite-jdbc-3.27.2.1.jar
# database properties: host, port number, name user, password
schemaspy.host=server
schemaspy.port=1433
schemaspy.db=db_name
schemaspy.u=database_user
schemaspy.p=database_password
# output dir to save generated files
schemaspy.o=Wrk
# db scheme for which generate diagrams
schemaspy.s-Wrk/book.sqlite

Console
(bionic)les@localhost:~/dgl-home/schemaspy$ java -jar schemaspy-6.1.0.jar -debug  ____       _                          ____
 / ___|  ___| |__   ___ _ __ ___   __ _/ ___| _ __  _   _
 \___ \ / __| '_ \ / _ \ '_ ` _ \ / _` \___ \| '_ \| | | |
  ___) | (__| | | |  __/ | | | | | (_| |___) | |_) | |_| |
 |____/ \___|_| |_|\___|_| |_| |_|\__,_|____/| .__/ \__, |
                                             |_|    |___/

                                              6.1.0

SchemaSpy generates an HTML representation of a database schema's relationships.
SchemaSpy comes with ABSOLUTELY NO WARRANTY.
SchemaSpy is free software and can be redistributed under the conditions of LGPL version 3 or later.
http://www.gnu.org/licenses/

INFO  - Starting Main v6.1.0 on localhost with PID 12470 (/home/les/dgl-home/schemaspy/schemaspy-6.1.0.jar started by les in /home/les/dgl-home/schemaspy)
INFO  - The following profiles are active: default
INFO  - Found configuration file: schemaspy.properties
INFO  - Started Main in 2.662 seconds (JVM running for 3.588)
DEBUG - Debug enabled
INFO  - Loaded configuration from schemaspy.properties
INFO  - Starting schema analysis
DEBUG - Resolving dbType: sqlite ->
	schemaspy-6.1.0.jar!/BOOT-INF/classes!/org/schemaspy/types/sqlite.properties
DEBUG - DbSpecificOption name: 'db' value: 'db_name' description: 'path to database or :memory:'
DEBUG - Unable to find driverClass 'SQLite.JDBCDriver'
WARN  - Connection Failure
org.schemaspy.input.dbms.exceptions.ConnectionFailure: Failed to connect to database URL [jdbc:sqlite:/db_name] Failed to create any of 'SQLite.JDBCDriver' driver from driverPath 'sqlite.jar' with sibling jars no.
Resulting in classpath:
	file:/home/les/dgl-home/schemaspy/sqlite.jar

	at org.schemaspy.input.dbms.DbDriverLoader.getConnection(DbDriverLoader.java:101)
	at org.schemaspy.input.dbms.DbDriverLoader.getConnection(DbDriverLoader.java:75)
	at org.schemaspy.input.dbms.service.SqlService.connect(SqlService.java:70)
	at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:220)
	at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:123)
	at org.schemaspy.cli.SchemaSpyRunner.runAnalyzer(SchemaSpyRunner.java:98)
	at org.schemaspy.cli.SchemaSpyRunner.run(SchemaSpyRunner.java:87)
	at org.schemaspy.Main.main(Main.java:55)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.schemaspy.input.dbms.exceptions.ConnectionFailure: Failed to create any of 'SQLite.JDBCDriver' driver from driverPath 'sqlite.jar' with sibling jars no.
Resulting in classpath:
	file:/home/les/dgl-home/schemaspy/sqlite.jar

	at org.schemaspy.input.dbms.DbDriverLoader.getDriver(DbDriverLoader.java:147)
	at org.schemaspy.input.dbms.DbDriverLoader.getConnection(DbDriverLoader.java:93)
	... 15 common frames omitted

Closing comment (2021-07-17T22:12:10Z): -t sqlite-xerial worked for me

-dbhelp lists both types with little distinction from the output. What would be an appropriate pull request? Would it be suffficient to amend sqlite-xerial.properties (in src/resources) with Xerial and also print out default driver name for -dbhelp? Then this default driver name should reflect Xerial-flavor, too, e.g. sqlite-xerial.jar.
Wasn't obvious to me (from the docs) how this works, running by type vs. ad-hoc extension. For years I used -t xerial.properties with necessary overrides for connectionSchema and driver class (with Xerial's sqlite driver).
Isn't this related to #524?