我尝试使用SchemaSpy连接到我的PostgresSQL服务器。我使用SELECT * FROM BundleName:Entity
oracle-java8-installer
安装了Java
(我的PostgreSQL服务器在Docker容器上工作,所以我将端口转发到5431)
我的ppa:webupd8team/java.
文件是:
schemaspy.properties
当我运行此命令时:
# 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
我确定lcoalhost:5431上的数据库可访问。但是我收到:
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
我应该添加一个驱动程序吗?我尝试了java -jar schemaspy-6.0.0.jar -configFile schemaspy.properties
。我从jdbc.postgresql.org网站下载了该行,并将此行添加到配置文件中。
postgresql-42.2.4.jar
但是它仍然显示相同的错误。
答案 0 :(得分:9)
好吧,我终于知道问题出在哪里。在定义数据库类型之后,应直接添加此行 schemaspy.dp = postgresql-42.2.4.jar
。现在,我的 schemaspy.properties
文件是:
#数据库类型。使用-dbhelp运行以获取详细信息
schemaspy.t = pgsql
#备用jdbc驱动程序的可选路径。
schemaspy.dp = postgresql-42.2.4.jar
#数据库属性:主机,端口号,名称用户,密码
schemaspy.host =本地主机:5431
schemaspy.port = 5431
schemaspy.db = dbname
schemaspy.u = dbuser
schemaspy.p = db密码
#输出目录以保存生成的文件
schemaspy.o = / home / user / dump
#为其生成图表的数据库方案
schemaspy.s =公共
并且正常工作。
答案 1 :(得分:0)
发生了什么事,由于连接问题,我下载的postgresql-42.2.4.jar
产生了一个空文件,为0个字节。起初我没有注意到它,因为文件在那里,所以我认为还可以。
因此,只需确保您的postgresql-42.2.4.jar
正常即可。也许重新下载它。