【测试类型:接口功能】【测试版本:6.0.0】 JDBC的getBlob()和getString()获取blob类型值与gsql查询值不一致
【操作系统和硬件信息】(查询命令: cat /etc/system-release, uname -a):
CentOS Linux release 7.6.1908 (Core)
Linux kwemhisprc01300 3.10.0-1062.el7.x86_64 #1 SMP Wed Aug 7 18:08:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
【测试环境】(单机/1主x备x级联备):单机
【被测功能】:blob类型
【测试类型】:功能测试
【数据库版本】(查询命令: gaussdb -V):
gaussdb (openGauss 6.0.0-RC1 build e4282ae9) compiled at 2024-03-29 11:00:19 commit 0 last mr
【预置条件】:数据库正常运行
【操作步骤】(请填写详细的操作步骤):
【预期输出】:
【实际输出】:
【原因分析】:
【日志信息】(请附上日志文件、截图、coredump信息):
【测试代码】:
Hey @ningyali, Welcome to openGauss Community.
All of the projects in openGauss Community are maintained by @opengauss_bot.
That means the developers can comment below every pull request or issue to trigger Bot Commands.
Please follow instructions at Here to find the details.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Hi @ningyali,
if you want to get quick review about your issue, please contact the owner in first: @周斌 ,
and then any of the maintainers: @Pike
and then any of the committers: @travelliu , @aaronwell , @Loong , @Kamus , @vimiix , @汪伟
if you have any question, please contact the SIG: Connectors.
数据库内核对b库返回的blob类型数据为十六进制的ASCII码,对a库返回的为原始数据的ASCII码,当前jdbc针对blob类型的处理是兼容的b库,所以a库查询值不正确。
对于blob类型,A库和B库的处理流程确实不一样:
A 库的blob类型是按照text进行存储的:
读取的时候也是按照text处理的:
因此返回给JDBC的就是字符串"1234"了:
对于B库:
blob是按照binary进行处理的:
返回给JDBC的也是按照binary的形式31323334返回的:
这个应该是为了解决一些特殊字符字使用符串存储不了等问题做的,因此A库和B库返回给JDBC的数据不一样应该是符合预期的,应该要在JDBC侧去适配处理一下。
与JDBC对齐,在JDBC侧修改,方案是只有B库,且dolphin.b_compatibility_mode = on的时候,blob的数据才按照16进制处理,其他的情形均按照文本处理。
登录 后才可以发表评论