【发布时间】:2017-08-15 00:52:33
【问题描述】:
我正在为 Oracle 12c 数据库使用 Liquibase maven 插件,运行更新命令时出现以下错误:
无法在项目 liquibase 上执行目标 org.liquibase:liquibase-maven-plugin:3.4.1:update(默认):设置或运行 Liquibase 时出错:liquibase.exception.DatabaseException: java.sql.SQLException: ORA- 28040: 没有匹配的身份验证协议
我看到有关此问题的相关堆栈溢出帖子,其中建议对 sqlnet.ora 文件进行更改,但以下命令使用完全相同的更改日志通过命令行完美运行:
java -jar ~/.m2/repository/org/liquibase/liquibase-core/3.5.3/liquibase-core-3.5.3.jar --driver=oracle.jdbc.OracleDriver --classpath=/Users/ nsalvi/Downloads/ojdbc6.jar --url="fake url" --username="fake username" --password="fake password" --changeLogFile=/Users/nsalvi/Downloads/liquibase-example-master-2/ src/main/resources/db/dbChangelog.xml 更新
上面我引用了我本地的驱动程序类路径。
我的 pom sn-p 如下所示:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.version}</version>
<configuration>
<propertyFileWillOverride>true</propertyFileWillOverride>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>${oracle.version}</version>
</dependency>
</dependencies>
</plugin>
当我运行 maven install 时,我得到了非身份验证协议错误。我的数据库变更日志如下:
liquibase.properties:
contexts: local
changeLogFile: db/dbChangelog.xml
driver: oracle.jdbc.OracleDriver
url: fake url
username: fake username
password: fake password
verbose: true
dropFirst: false
dbChangelog.xml:
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.8"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.8
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.8.xsd">
<preConditions>
<dbms type="oracle" />
<runningAs username="fake" />
</preConditions>
<changeSet id="1" author="nishant">
<preConditions onFail="WARN">
<sqlCheck expectedResult="9">select count(*) from CA_PROJECT_T</sqlCheck>
</preConditions>
<comment>Comments should go after preCondition. If they are before then liquibase usually gives error.</comment>
</changeSet>
</databaseChangeLog>
有什么我想念的吗? P.S.-当有问题的数据库是 mysql 而不是 oracle 时,maven 插件工作得很好,我不认为在 sqlnet.ora 文件中进行更改是这里的问题,因为从命令行运行时查询工作得很好。
提前致谢!
【问题讨论】:
标签: java eclipse oracle maven liquibase