Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SchemaSpy PostgreSQL - WARN - Connection Failure

I try to connect to my PostgresSQL server using SchemaSpy. I installed Java using oracle-java8-installer from ppa:webupd8team/java.

(My PostgreSQL server works on Docker container so I forward port to 5431)

My schemaspy.properties file is:

# type of database. Run with -dbhelp for details
schemaspy.t=pgsql
# optional path to alternative jdbc drivers.
# database properties: host, port number, name user, password
schemaspy.host=localhost:5431
schemaspy.port=5431
schemaspy.db=dbname
schemaspy.u=dbuser
schemaspy.p=dbpassword
# output dir to save generated files
schemaspy.o=dbschema
# db scheme for which generate diagrams
schemaspy.s=public

When I run this command:

java -jar schemaspy-6.0.0.jar -configFile schemaspy.properties

I'm sure that database is reacheable on lcoalhost:5431. However I receive:

user@hostname:~/path-to-app$ java -jar schemaspy-6.0.0.jar -configFile schemaspy.properties 
  ____       _                          ____
 / ___|  ___| |__   ___ _ __ ___   __ _/ ___| _ __  _   _
 \___ \ / __| '_ \ / _ \ '_ ` _ \ / _` \___ \| '_ \| | | |
  ___) | (__| | | |  __/ | | | | | (_| |___) | |_) | |_| |
 |____/ \___|_| |_|\___|_| |_| |_|\__,_|____/| .__/ \__, |
                                             |_|    |___/

                                              6.0.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.0.0 on hostname with PID 18555 (/home/user/path-to-app/schemaspy-6.0.0.jar started by user in /home/user/path-to-app)
INFO  - The following profiles are active: default
INFO  - Found configuration file: schemaspy.properties
INFO  - Started Main in 3.406 seconds (JVM running for 4.519)
INFO  - Starting schema analysis
WARN  - Connection Failure

Should I add a driver? I tried with postgresql-42.2.4.jar. I downloaded it from jdbc.postgresql.org site and added this line to config file.

schemaspy.dp=postgresql-42.2.4.jar

However it still shows the same error.

like image 855
karwan Avatar asked Aug 07 '18 12:08

karwan


2 Answers

Ok I finally know what was the problem. This line schemaspy.dp=postgresql-42.2.4.jar should be added directly after definition of type of database. Now my schemaspy.properties file is:

# type of database. Run with -dbhelp for details
schemaspy.t=pgsql
# optional path to alternative jdbc drivers.
schemaspy.dp=postgresql-42.2.4.jar
# database properties: host, port number, name user, password
schemaspy.host=localhost:5431
schemaspy.port=5431
schemaspy.db=dbname
schemaspy.u=dbuser
schemaspy.p=dbpassword
# output dir to save generated files
schemaspy.o=/home/user/dump
# db scheme for which generate diagrams
schemaspy.s=public

And works properly.

like image 184
karwan Avatar answered Sep 28 '22 04:09

karwan


What happened to me is that, due to a connection problem, my download of postgresql-42.2.4.jar yielded an empty file, 0 bytes. I didn't notice it at first because the file was there, so I thought it was ok.

So just make sure that your postgresql-42.2.4.jar is OK. Maybe re-download it.

like image 38
Pedro A Avatar answered Sep 28 '22 06:09

Pedro A