我正在尝试从我拥有的 Openshift
机器运行 liquibase 更新。看起来像
> java -jar ~/.m2/repository/org/liquibase/liquibase-core/3.1.1/liquibase-core-3.1.1.jar --driver=org.postgresql.Driver --classpath=wildfly/standalone/deployments/ROOT.war --changeLogFile=liquibase/changelog.xml --url="jdbc:$OPENSHIFT_POSTGRESQL_DB_URL/mydb" --username=$OPENSHIFT_POSTGRESQL_DB_USERNAME --password=OPENSHIFT_POSTGRESQL_DB_PASSWORD update
我看到以下错误
Liquibase update Failed: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql://admin:29asDVjpFxYl6@127.8.201.2:5432/mydb with driver org.postgresql.Driver. Possibly the wrong driver for the given database URL
这里出了什么问题?
我正在使用以下 postgreSQL
依赖项
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
最佳答案
修复了以下2个问题
a.) 使用 postgres 9.2 驱动程序
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.2-1003-jdbc4</version>
</dependency>
b.) 使用以下网址
--url="jdbc:postgresql://$OPENSHIFT_POSTGRESQL_DB_HOST:$OPENSHIFT_POSTGRESQL_DB_PORT/mydb"
关于java - PostgreSQL + Openshift : Possibly the wrong driver for the given database URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26569302/