SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4529fa91]和错误号码2003以及前台拿不到数据

本文记录了一次因数据库服务未正常启动导致的前后端数据交互问题。详细描述了从误判代码错误到发现数据库服务状态异常的过程,以及如何通过重启服务解决数据库连接问题。

前台拿不到数据
后台显示SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4529fa91]
经验不足误认为代码有问题实际上数据库没有连接成功
数据库服务已设置为自动启动,打开数据库管理软件,报错误号码2003,查了一下才知道这是数据库服务没有开启
去管理服务看了一下,果然是服务没有自启,启动服务,数据库连接成功,前台也拿到了数据

Creating a new SqlSession SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6d2bf1a5] was not registered for synchronization because synchronization is not active JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@4dae0fa1] will not be managed by Spring ==> Preparing: SELECT * FROM t_product_category WHERE parent_id=? ==> Parameters: 290(Integer) <== Columns: id, parent_id, name, status, sort_order, is_parent, created_time, modified_time, created_user, modified_user <== Row: 291, 290, 钟表, 1, 1, 1, 2017-10-25 15:00:55, 2017-10-25 15:00:55, admin, admin <== Total: 1 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6d2bf1a5] 当前业务耗费3ms Creating a new SqlSession SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6d40077d] was not registered for synchronization because synchronization is not active JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@4dae0fa1] will not be managed by Spring ==> Preparing: SELECT * FROM t_product_category WHERE parent_id=? ==> Parameters: 438(Integer) <== Columns: id, parent_id, name, status, sort_order, is_parent, created_time, modified_time, created_user, modified_user <== Row: 439, 438, 维修保养, 1, 1, 1, 2017-10-25 15:00:55, 2017-10-25 15:00:55, admin, admin <== Row: 456, 438, 车载电器, 1, 2, 1, 2017-10-25 15:00:55, 2017-10-25 15:00:55, admin, admin <== Row: 467, 438, 美容清洗, 1, 3, 1, 2017-10-25 15:00:55, 2017-10-25 15:00:55, admin, admin <== Row: 474, 438, 汽车装饰, 1, 4, 1, 2017-10-25 15:00:55, 2017-10-25 15:00:55, admin, admin <== Row: 486, 438, 安全自驾, 1, 5, 1, 2017-10-25 15:00:55, 2017-10-25 15:00:55, admin, admin <== Total: 5 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6d40077d] 当前业务耗费4ms
06-04
2025-09-10 15:02:25.494 INFO 13856 --- [io-48089-exec-3] c.i.g.f.a.c.i.ApiAccessLogInterceptor : [preHandle][开始请求 URL(/admin-api/fastener/trends/getFocusNewsList) 无参数] Controller 方法路径:cn.iocoder.gmy.module.fastener.trends.controller.TrendsController(TrendsController.java:33) Creating a new SqlSession SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@31ce139e] was not registered for synchronization because synchronization is not active original SQL: SELECT id,cover_img FROM home_news WHERE cover_img IS NOT NULL ORDER BY create_time DESC LIMIT 5 SQL to parse, SQL: SELECT id,cover_img FROM home_news WHERE cover_img IS NOT NULL ORDER BY create_time DESC LIMIT 5 parse the finished SQL: SELECT id, cover_img FROM home_news WHERE cover_img IS NOT NULL ORDER BY create_time DESC LIMIT 5 JDBC Connection [ConnectionProxyImpl{connectedTime=2025-09-10 15:00:15.401, closeCount=0, lastValidateTimeMillis=2025-09-10 15:01:35.87}] will not be managed by Spring ==> Preparing: SELECT id, cover_img FROM home_news WHERE cover_img IS NOT NULL ORDER BY create_time DESC LIMIT 5 ==> Parameters: <== Columns: id, cover_img <== Row: 451, https://g1.gongmiyunpt.com:9000/gmy/20250829/1aa1a8c67680de02c978c4058e49be235419ee25ee659bd0cd08f82d633f20a2_1756459638989.png <== Row: 441, http://47.111.71.174:48080/admin-api/infra/file/31/get/20250701/2feee57a04d4a093c0eda7d08247a4cd481418d5091e6f001078cf193d038bcc_1751332606533.png <== Row: 440, http://47.111.71.174:48080/admin-api/infra/file/31/get/20250701/86de478b17cba7199094a50db224559c0a7182ee0e92b182fa0f471feb6244c5_1751332374952.png <== Row: 438, http://47.111.71.174:48080/admin-api/infra/file/31/get/20250630/c700d5b2ce10ae5839d43b7649c39ec2c13094e9ec636f73f30bb3df61d20e3e_1751269160619.jpg <== Row: 437, http://47.111.71.174:48080/admin-api/infra/file/31/get/20250630/b23e6938c43f07c49a6c95dc840f0527b16cc5cc2d17f9e8fc334ba0fb17394d_1751269010458.png <== Total: 5 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@31ce139e] Creating a new SqlSession SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4bc91462] was not registered for synchronization because synchronization is not active original SQL: SELECT id,title,cover_img FROM home_news WHERE cover_img IS NOT NULL ORDER BY create_time DESC LIMIT 2 SQL to parse, SQL: SELECT id,title,cover_img FROM home_news WHERE cover_img IS NOT NULL ORDER BY create_time DESC LIMIT 2 parse the finished SQL: SELECT id, title, cover_img FROM home_news WHERE cover_img IS NOT NULL ORDER BY create_time DESC LIMIT 2 JDBC Connection [ConnectionProxyImpl{connectedTime=2025-09-10 15:00:15.401, closeCount=0, lastValidateTimeMillis=2025-09-10 15:01:35.87}] will not be managed by Spring ==> Preparing: SELECT id, title, cover_img FROM home_news WHERE cover_img IS NOT NULL ORDER BY create_time DESC LIMIT 2 ==> Parameters: <== Columns: id, title, cover_img <== Row: 451, 测试图片上传, https://g1.gongmiyunpt.com:9000/gmy/20250829/1aa1a8c67680de02c978c4058e49be235419ee25ee659bd0cd08f82d633f20a2_1756459638989.png <== Row: 441, 规模超千亿!低空经济基金落地,将撬动紧固件产业链升级, http://47.111.71.174:48080/admin-api/infra/file/31/get/20250701/2feee57a04d4a093c0eda7d08247a4cd481418d5091e6f001078cf193d038bcc_1751332606533.png <== Total: 2 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4bc91462]
最新发布
09-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值