SchemaSpy PostgreSQL - 警告 - 连接失败 [英] SchemaSpy PostgreSQL - WARN - Connection Failure

查看:48
本文介绍了SchemaSpy PostgreSQL - 警告 - 连接失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 SchemaSpy 连接到我的 PostgresSQL 服务器.我使用 ppa:webupd8team/java 中的 oracle-java8-installer 安装了 Java.

(我的 PostgreSQL 服务器在 Docker 容器上运行,所以我将端口转发到 5431)

我的 schemaspy.properties 文件是:

# 数据库类型.使用 -dbhelp 运行以获取详细信息schemaspy.t=pgsql# 替代 jdbc 驱动程序的可选路径.# 数据库属性:主机、端口号、用户名、密码schemaspy.host=localhost:5431schemaspy.port=5431schemaspy.db=dbnameschemaspy.u=dbuserschemaspy.p=dbpassword# 输出目录保存生成的文件schemaspy.o=dbschema# 生成图表的数据库方案schemaspy.s=public

当我运行这个命令时:

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

我确信可以在 lcoalhost:5431 上访问数据库.但是我收到:

<前>user@hostname:~/path-to-app$ java -jar schemaspy-6.0.0.jar -configFile schemaspy.properties____ _ ____/___|___||__ ___ _ __ ___ __ _/___|_ _ _ _\___ \/__|'_ \/_ \ '_ ` _ \/_` \___ \|'_ \||||___) |(__| | | | __/| | | | (_| |___) | |_) ||_|||____/\___|_||_|\___|_||_||_|\__,_|____/|.__/\__, ||_||___/6.0.0SchemaSpy 生成数据库模式关系的 HTML 表示.SchemaSpy 绝对没有任何保证.SchemaSpy 是免费软件,可以在 LGPL 版本 3 或更高版本的条件下重新分发.http://www.gnu.org/licenses/信息 - 在 PID 为 18555 的主机名上启动 Main v6.0.0(/home/user/path-to-app/schemaspy-6.0.0.jar 由用户在/home/user/path-to-app 中启动)信息 - 以下配置文件处于活动状态:默认信息 - 找到配置文件:schemaspy.properties信息 - 在 3.406 秒内启动 Main(JVM 运行 4.519)信息 - 开始模式分析警告 - 连接失败

我应该添加驱动程序吗?我尝试使用 postgresql-42.2.4.jar.我从 jdbc.postgresql.org 站点下载了它,并将这一行添加到配置文件中.

schemaspy.dp=postgresql-42.2.4.jar

但是它仍然显示相同的错误.

解决方案

好吧,我终于知道问题出在哪里了.这行schemaspy.dp=postgresql-42.2.4.jar应该直接添加在定义数据库类型之后.现在我的 schemaspy.properties 文件是:

# 数据库类型.使用 -dbhelp 运行以获取详细信息schemaspy.t=pgsql# 替代 jdbc 驱动程序的可选路径.schemaspy.dp=postgresql-42.2.4.jar# 数据库属性:主机、端口号、用户名、密码schemaspy.host=localhost:5431schemaspy.port=5431schemaspy.db=dbnameschemaspy.u=dbuserschemaspy.p=dbpassword# 输出目录保存生成的文件schemaspy.o=/home/user/dump# 生成图表的数据库方案schemaspy.s=public

并且工作正常.

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.

解决方案

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.

这篇关于SchemaSpy PostgreSQL - 警告 - 连接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆