GithubHelp home page GithubHelp logo

[Bug]: 当JDBC预编译参数值全为 null 时必报错:com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure about oceanbase HOT 7 OPEN

CodePlayer avatar CodePlayer commented on June 3, 2024
[Bug]: 当JDBC预编译参数值全为 null 时必报错:com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

from oceanbase.

Comments (7)

hnwyllmm avatar hnwyllmm commented on June 3, 2024 1

使用MySQL原生驱动没有问题,现在看来不着急升级驱动可以正常运行。
4.3,预估在9月底发布GA(一般可用(General availability, 缩写GA))版本。感谢关注。

from oceanbase.

hnwyllmm avatar hnwyllmm commented on June 3, 2024

收到,感谢反馈,我们重现一下看。

from oceanbase.

hnwyllmm avatar hnwyllmm commented on June 3, 2024

抱歉使用setNull的方式没有重现。
我看到你的描述:“使用原生JDBC代码执行 SELECT * FROM t_user WHERE id = ?,哪怕只有一个预编译参数,只要参数值为null,就会报同样的错。”
看起来已经可以使用JDBC代码来重现,发一下JDBC重现的代码?多谢

from oceanbase.

hnwyllmm avatar hnwyllmm commented on June 3, 2024

我们使用mysql-connector-java-8.0.30 重现了这个问题。
可以改用 mysql-connector-java-8.0.20 没有这个问题,可以替换使用这个驱动。
或者使用ob提供的jdbc,我们使用 2410 版本没有问题

from oceanbase.

CodePlayer avatar CodePlayer commented on June 3, 2024

抱歉使用setNull的方式没有重现。 我看到你的描述:“使用原生JDBC代码执行 SELECT * FROM t_user WHERE id = ?,哪怕只有一个预编译参数,只要参数值为null,就会报同样的错。” 看起来已经可以使用JDBC代码来重现,发一下JDBC重现的代码?多谢

如下所示,原生 JDBC 代码很简单。不过我们使用的不是 setNull,而是 setObject( index, null )

Connection conn = dataSource.getConnection();
try {
	PreparedStatement ps = conn.prepareStatement("SELECT id FROM t_user WHERE id = ?");
	ps.setObject(1, null); // ps.setNull(1, Types.BIGINT);
	ps.execute();
} catch (SQLException e) {
	throw new RuntimeException(e);
}

更换驱动版本,多次测试,初步验证出如下结论:

  • mysql-connector-java-8.0.28 及以下版本不会报错,以上版本就会报错(仅测试了 8.0.20 ~ 8.0.33 之间的版本)。
  • 不管是使用 setNull 还是 setObject,结果都是一样的。
  • 不过,如果是连接 MySQL 数据库,不管哪个版本,都不会报错。

from oceanbase.

CodePlayer avatar CodePlayer commented on June 3, 2024

目前我们有多个环境,并未全部更换为 OceanBase,因此需要在多个环境的 OceanBase 和 MySQL 之间来回测试,以验证兼容性。
所以,目前还是打算使用 MySQL 提供的 JDBC 驱动,暂时还不宜使用 OceanBase 官方提供的 驱动包。

请问,如果使用 OceanBase 官方驱动包,除了更好的兼容性外,在性能方面会有更好的表现么 ?

BTW, 不知道 OceanBase 4.3 大概什么时候能够发布正式版 ?貌似该版本加了不少 OLAP 的新特性,比较眼馋~

from oceanbase.

hnwyllmm avatar hnwyllmm commented on June 3, 2024

原因已找到,正在修复。

from oceanbase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.