New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: 当JDBC预编译参数值全为 null 时必报错:com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure #1948
Comments
收到,感谢反馈,我们重现一下看。 |
抱歉使用setNull的方式没有重现。 |
我们使用mysql-connector-java-8.0.30 重现了这个问题。 |
如下所示,原生 JDBC 代码很简单。不过我们使用的不是 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);
} 更换驱动版本,多次测试,初步验证出如下结论:
|
目前我们有多个环境,并未全部更换为 OceanBase,因此需要在多个环境的 OceanBase 和 MySQL 之间来回测试,以验证兼容性。 请问,如果使用 OceanBase 官方驱动包,除了更好的兼容性外,在性能方面会有更好的表现么 ? BTW, 不知道 OceanBase 4.3 大概什么时候能够发布正式版 ?貌似该版本加了不少 OLAP 的新特性,比较眼馋~ |
使用MySQL原生驱动没有问题,现在看来不着急升级驱动可以正常运行。 |
原因已找到,正在修复。 |
Describe the bug
使用 MySQL JDBC 驱动连接 OceanBase,如果预编译参数的值全部为
null
,则必定报错。Environment
Fast Reproduce Steps(Required)
Steps to reproduce the behavior:
目前已知的情况如下:
mysql-connector-j 8.3.0
,没有使用其他版本测试过,但结果应该是一样的。null
参数中的任何一个参数改为非null
值,查询就会正常执行,并返回符合预期的结果。也就是说,只有 全部 的预编译参数值都为null
,才会报错。SELECT * FROM t_user WHERE id = ?
,哪怕只有一个预编译参数,只要参数值为null
,就会报同样的错。Expected behavior
期望正确返回,而不是报错。
Actual Behavior
The text was updated successfully, but these errors were encountered: