作为构建过程的一部分,我们使用mysqldiff实用程序(从maven调用)通过将新构建的模式副本与从基线创建的模式版本以及迁移脚本进行比较来验证数据库迁移脚本.这一切都适用于MySQL 5.7.
我们正在寻求升级到MySQL 8.0.13.数据库用户已配置为使用mysql_native_password.当我们运行构建时,我们会收到以下错误mysqldiff:
ERROR: Authentication plugin 'caching_sha2_password' is not supported
Run Code Online (Sandbox Code Playgroud)
我们知道这个错误是由于该实用程序使用旧版本的mysql-python-connector.我们也理解答案可能就像升级连接器版本一样简单,但我们不知道如何尝试.
可以在https://github.com/mysql/mysql-utilities找到MySQL Utilities .
在Windows 10上,我们使用Oracle Windows安装程序进行安装.在Amazon Linux上,我们使用yum进行安装.
注意:
我们如何解决这个错误,以便我们可以在Windows 10和Amazon Linux上使用mysqldiff和MySQL 8.0.13服务器?
如果答案只是升级连接器,那么执行此操作的详细步骤是什么?
我们可以进行服务器安装/配置更改以支持连接旧驱动程序的客户端吗?
在我执行合并的方法中,JPA为什么不为唯一约束违例引发异常?相反,我在代码中看到了引发异常的地方。
我想获取诸如(Update Error)之类的异常消息,但没有捕获到异常。
我想得到这个回应:
{
    "errorMessage": "Update Error",
    "errorCode": 404,
    "documentation": ""
}
Run Code Online (Sandbox Code Playgroud)
相反,在控制台中出现此错误:
Caused by: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
.....
...
Caused by: javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
.....
.....
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement
......
.....
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (DEMAND_TD_CODE) violated
.....
....
Run Code Online (Sandbox Code Playgroud)
这是我进行更新的地方:
@Override
    public Demand updateDemand(Demand demand) throws DemandExceptions {
        try {
            Demand demandToUpdate = entityManager.merge(demand);
        } catch (PersistenceException e) {
            throw new DemandExceptions("Update Error");
        }
            return demandToUpdate;
    } …Run Code Online (Sandbox Code Playgroud)