我正在尝试运行liquibase以生成当前数据库的变更日志,但是出现以下错误,并且不确定如何解决。
Unexpected error running Liquibase: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgres://kbjoxiifqvunac:ef1f6ba0b9633d5951c6f4a28897fe390fdf2a7f4189320569d303531899e843@ec2-54-217-235-159.eu-west-1.compute.amazonaws.com:5432/d1pdhars1kb6ep with driver org.postgresql.Driver. Possibly the wrong driver for the given database URL
liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgres://kbjoxiifqvunac:ef1f6ba0b9633d5951c6f4a28897fe390fdf2a7f4189320569d303531899e843@ec2-54-217-235-159.eu-west-1.compute.amazonaws.com:5432/d1pdhars1kb6ep with driver org.postgresql.Driver. Possibly the wrong driver for the given database URL
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:135) ~[liquibase.jar:na]
at liquibase.integration.commandline.Main.doMigration(Main.java:977) [liquibase.jar:na]
at liquibase.integration.commandline.Main.run(Main.java:209) [liquibase.jar:na]
at liquibase.integration.commandline.Main.main(Main.java:132) [liquibase.jar:na]
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgres://kbjoxiifqvunac:ef1f6ba0b9633d5951c6f4a28897fe390fdf2a7f4189320569d303531899e843@ec2-54-217-235-159.eu-west-1.compute.amazonaws.com:5432/d1pdhars1kb6ep with driver org.postgresql.Driver. Possibly the wrong driver for the given database URL
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:259) ~[liquibase.jar:na]
at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:149) ~[liquibase.jar:na]
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:100) ~[liquibase.jar:na]
... 3 common frames omitted
Caused by: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgres://kbjoxiifqvunac:ef1f6ba0b9633d5951c6f4a28897fe390fdf2a7f4189320569d303531899e843@ec2-54-217-235-159.eu-west-1.compute.amazonaws.com:5432/d1pdhars1kb6ep with driver org.postgresql.Driver. Possibly the wrong driver for the given database URL
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:254) ~[liquibase.jar:na]
... 5 common frames omitted
我已经运行了以下命令
liquibase --driver=org.postgresql.Driver --changeLogFile=changelog.xml --url=jdbc:postgres://user:password@ec2-54-217-235-159.eu-west-1.compute.amazonaws.com:5432/dbhost generateChangeLog
由于我将postgres驱动程序放入liquibase的lib文件夹中,因此我省略了classpath标志,并且根据文档应该对其进行扫描。
我正在Windows,Liquibase版本3.8.0和postgres-drivers 42.1.1上运行。有任何想法吗?预先感谢您的帮助
答案 0 :(得分:0)
我认为您的驱动程序jar应该位于lib
目录中,而不是bin
目录中。如果您从liquibase.bat
看这些行,您会发现它在bin
目录中添加了以liquibase
开头的所有jar文件,然后添加了 ALL lib目录中的> jar文件。
set CP=.
for /R %LIQUIBASE_HOME% %%f in (liquibase*.jar) do set CP=!CP!;%%f
for /R %LIQUIBASE_HOME%\lib %%f in (*.jar) do set CP=!CP!;%%f