草稿
[WIP]【实习#27】新增 Spring Boot 配合 MySQL JDBC 连接 openGauss B 库示例与自测 #110
[WIP]【实习#27】新增 Spring Boot 配合 MySQL JDBC 连接 openGauss B 库示例与自测 #110
草稿
wsrym创建于 13 小时前
wsrym
wsrym
13 小时前

【标题】新增 Spring Boot 配合 MySQL JDBC 连接 openGauss B 库示例与自测

【实现内容】:
新增 springboot-connect-opengauss-b/ 示例工程(Spring Boot 3.5.16 + MySQL Connector/J 经 dolphin MySQL 协议连接 openGauss B 兼容库,端口 3308):

  1. 示例工程本体:pom.xml(8 个驱动 profile 扫测矩阵)、application.yml(凭据仅环境变量注入)、SmokeApplication / TxService;
  2. 测试代码 28 用例:六维度 25 个(连接与认证 4、类型映射与文档参数 8、DML 批量 3、事务 5、连接池 2、已知限制专项 3)+ Spring Boot 冒烟 3 个;
  3. 测试思维导图(.mm/.md/.html)与自测报告(docs/ 目录);
  4. 驱动版本矩阵:8 档(BOM 默认档 + 7 个显式版本,8.0.28 ~ 26.7.0)共 224 例次全部通过。

【根因分析】:
官方开发指导文档声明的驱动支持范围为 8.0.28 及其以下,而 Spring Boot 3.x BOM 默认管理 mysql-connector-j 新坐标(9.x),文档与主流用法存在断档;社区缺少 Spring Boot 配合 MySQL JDBC 连接 openGauss B库的实测示例与验证数据,用户无法判断新驱动版本是否可用。

【实现方案】:
以六维度用例建立基线,再用 Maven profile 矩阵扫描 8 档驱动验证版本边界;对每项与 MySQL 原生行为的差异用最小复现定位归属(驱动侧 / 服务端侧),差异以 FINDING 记录并给出规避措施。

【关联需求或issue】:
https://gitcode.com/opengauss/opensource-intership/issues/27

【开发自验报告】:

  1. 请附上自验结果(内容或者截图)
    自测结论:28/28 用例 × 8 档 = 224 例次全部通过(Failures=0, Errors=0, Skipped=0),详见工程内 docs/基于SpringBoot框架的openGauss数据库测试.md。关键结论:基础
    CRUD、事务、批量、类型映射、连接池均可正常工作且与驱动版本无关(8.0.28 ~ 26.7.0 行为逐项一致);rewriteBatchedStatements=true 实测约 17 倍提速;官方文档 6 个 JDBC 参数逐项实测(3 项验证生效,3项与文档声明一致)。记录 FINDING 3 项(information_schema.TABLES 元数据缺失 / 零日期不支持 / SERIALIZABLE→REPEATABLE_READ 映射),均可规避;另定位存储过程报错的元数据根源(information_schema.PARAMETERS缺失)。

  2. 是否可以添加fastcheck测试用例,如是,请补充fastcheck用例
    否。examples 仓为示例与自测代码,不纳入服务端 fastcheck 回归用例体系。

  3. 是否涉及资料修改,如是,在docs仓库补充资料
    是。基于 Spring Boot 开发指导文档(springboot_development.md)已单独提 PR 至 docs 仓。

  4. 是否考虑升级场景(系统表修改、日志持久化以及修改执行态数据格式)
    否。示例工程不修改数据库对象或执行态。

  5. 是否考虑在线扩容等扩展场景
    否。

  6. 是否考虑异常场景/并发场景/前向兼容/性能场景
    是。已覆盖错误密码/错误用户名/错误端口、连接池上限、批量性能对比、8 档驱动前向兼容;高并发与故障注入未覆盖,已在报告遗留问题中说明。

  7. 是否对其他模块产生影响
    否。独立示例工程,不影响其他模块。

  8. 是否需要回合补丁版本(5.0、6.0),涉及(结果错误|coredump|性能劣化|内存泄露|集群异常)相关修复请排查回合补丁分支
    否。本 PR 为示例与自测代码,无服务端代码修改,不涉及上述缺陷修复。

  9. 针对Plugin仓dolphin插件,新增/修改的代码是否已使用 DOLPHIN 宏进行控制,方便后续回合openGauss-server仓代码
    否。本 PR 不含 dolphin 插件代码修改。

【当前PR是否有AI参与】:
[ ] 否
[√] 是
__1. AI Agent 平台: Claude Code 2.1.251
__2. AI 模型: DeepSeek-V4-Pro
__3. Prompt上下文: Adapt Spring Boot with MySQL JDBC to openGauss B-mode via dolphin MySQL protocol; deliver test code, mind map, self-test report and docs guide for internship issue #27

【其他说明】:
实测环境 openGauss 7.0.0-RC3(源码编译,commit fe6f6e4b),与任务要求的 7.0.0-LTS 在 MySQL 协议兼容行为上应一致,正式版发布后建议用同一套用例回归。FINDING A/D(information_schema
元数据缺失、隔离级别映射)后续将提 Plugin 仓 issue。代码由 AI 辅助编写,开发者已人工逐行核对并在实机环境运行验证;凭据无硬编码(仅环境变量注入),敏感信息已脱敏。

likedislike
合并受阻
wsrymwsrym
13 小时前 创建了 pull request,commit bfe616f1
wsrymwsrym
13 小时前 关联了issue:[开源实习]: openGauss B库B协议适配MySQL Java框架 Spring Boot
opengauss_botopengauss_bot成员
13 小时前 将ywzq1161327784,chenxiaobin19,totaj,congzhou2603,shenzheng4,chendong76,dodders,muyulinzhong,shirley_zhengx,quemingjian,jemappellehc,wofanzheng,wlff234,libiao2024,hwworkholic,CarrotGo,superlchf设为审查人
opengauss_botopengauss_bot成员
13 小时前 添加了label:sig/Infra
opengauss_bot
opengauss_bot成员
13 小时前 评论:

Welcome To openGauss Community

Hey @lele-2026 , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. You can self-configure the PR merge rules for this repository. For more details, please refer to Here.

Contact Guide

If you have any questions, please contact the SIG: Infra ,
and any of the maintainers: @CarrotGo, @chendong76, @chenxiaobin19, @congzhou2603, @dodders, @hwworkholic, @jemappellehc, @libiao2024, @muyulinzhong, @quemingjian, @shenzheng4, @shirley_zhengx, @superlchf, @totaj, @wlff234, @wofanzheng, @ywzq1161327784 ,
and any of the committers: @ailoooong, @gzbang, @libiao2024, @zhangxubo .

likedislike
opengauss_botopengauss_bot成员
13 小时前 添加了label:stat/needs-squash
此处折叠了6条事件消息 查看更多
opengauss_botopengauss_bot成员
12 小时前 删除了label:stat/needs-squash
opengauss_bot
opengauss_bot成员
12 小时前 评论:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): stat/needs-squash.

likedislike
opengauss_botopengauss_bot成员
12 小时前 添加了label:opengauss-cla/yes
此处折叠了7条事件消息 查看更多
opengauss_botopengauss_bot成员
4 小时前 添加了label:opengauss-cla/yes
opengauss_bot
opengauss_bot成员
4 小时前 评论:

CLA Signature Pass

lele-2026, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike