【问题标题】:Issue integrating mariaDB client with MySQL DB将 mariaDB 客户端与 MySQL DB 集成的问题
【发布时间】:2020-11-26 17:33:42
【问题描述】:

我正在运行一个使用 MySQL 作为数据库服务器的 java 应用程序。 DB 是 AWS RDS。 MySQL 连接器是在 GNU/GPL 下发布的,因此必须用更宽松的东西代替它。 Maria DB 客户端声称兼容。但是自从使用 MariaDB 客户端以来,我们在 DB 密集型活动期间看到了以下间歇性问题:

Excption:-
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/Projectname] threw exception [Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection] with root cause
java.sql.SQLNonTransientConnectionException: (conn=1530488) Connection is closed
    at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:73)
    at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:187)
    at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.cmdPrologue(AbstractQueryProtocol.java:1940)

Caused by: org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection
    at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:48)
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)

Caused by: java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=XXXXXXXXXX)(port=3306)(type=master) : (conn=1530487) could not load system variables
    at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:73)
    at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:192)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1372)

我已尝试将time_waitmax_allowed_packet 增加到允许的最大值,但问题仍然存在。

版本:- MySQL - 5.7.26 MariaDB 连接器 - 2.6.2

【问题讨论】:

    标签: java mysql mariadb


    【解决方案1】:

    刚刚遇到这个,找到了答案。在我这边,这是针对 Aurora 1 MySQL 数据库(相当于 5.6)。

    根据 Diego Dupin 在https://jira.mariadb.org/browse/CONJ-824:

    only good solution is to use option `usePipelineAuth=false&useBatchMultiSend=false`
    

    所以您的数据库连接字符串可能如下所示: jdbc:mysql://127.0.0.1:3307/mydbname?usePipelineAuth=false&useBatchMultiSend=false

    更多细节:

    Aurora proxy has a known race condition issue that results in skipping other 
    queries in proxy buffer. connection might be in hang waiting for query response. 
    During authentication, socket has a timeout, that will result throwing the error 
    you describe.
    
    So if `usePipelineAuth` or `useBatchMultiSend` is enable, it might work ... or not. 
    All pipeline options (`usePipelineAuth` and `useBatchMultiSend`) must be disabled when using aurora. 
    Problem has been reported to aurora a few times without correction.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-02
      • 2016-06-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-25
      • 1970-01-01
      相关资源
      最近更新 更多