java报错Error attempting to get column ‘XXX’ from result set. Cause: java.sql.怎么解决?

在这里插入图片描述

在写java的时候,各种问题层出不穷。特别是对于新手来说。 头一次写java 项目,遇到问题后就只能百度搜索查询。

java开发中不常碰到的问题,例如:

  1. 引入包的版本问题。
  2. 版本不兼容问题。
  3. 我们是没发一次性知道的。只有在做某些特定时期的时候才能知晓。

就比如,笔者也是一个java新手,头一次的java项目中就遇到了如下问题:

项目使用 SpringBoot + Mybatis-plus
用到了LocalDateTime 类型。
然而在转换时候报错

Error attempting to get column 'XXX' from result set. Cause: java.sql.

这时候我们的解题思路是什么呢?

既然是类型问题,我们就必须找找类型的事。

  1. 查看数据库中的时间字段,发现类型是:datetime。
  2. 而我们的实际项目中使用的则是 LocalDatetime类型。
  3. 当我们确定后再尝试,会发现导致查询报错的就是这个类型问题。

那么如何解决这个问题呢?

最简单的就是更换druid。也就是集成了druid数据源的问题。通过查看mybatis-plus更新文档得知。

mybatis-plus 3.1.1+ 版本
使用了新版的jdbc,LocalDateTime等日期类型处理方式给做了一定的升级、但是我们集成进来的druid在1.1.21版本之前不支持LocalDateTime。

在这里插入图片描述
如上图所示,3.1.1版本之后做个升级处理

因此我们断定:
是因为com.alibaba 的版本问题。

解决方法:

  1. 切换版本号到1.1.22 即可消除问题
   <dependency>
         <groupId>com.alibaba</groupId>
         <artifactId>druid-spring-boot-starter</artifactId>
         <version>1.1.22</version>
   </dependency>
  1. 让mybatis-plus版本保持在3.1.0.
  2. 如果非要使用最新版本的mybatis-plus,我们就必须换掉druid数据源。采用spring boot 默认数据源。让它保持于mybatis-plus 的版本保持紧跟即可。
  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
Title: Computer Graphics Through OpenGL: From Theory to Experiments, 3rd Edition Author: Sumanta Guha Length: 760 pages Edition: 3 Language: English Publisher: Chapman and Hall/CRC Publication Date: 2019-01-07 ISBN-10: 1138612642 ISBN-13: 9781138612648 Description COMPREHENSIVE COVERAGE OF SHADERS AND THE PROGRAMMABLE PIPELINE From geometric primitives to animation to 3D modeling to lighting, shading and texturing, Computer Graphics Through OpenGL®: From Theory to Experiments is a comprehensive introduction to computer graphics which uses an active learning style to teach key concepts. Equally emphasizing theory and practice, the book provides an understanding not only of the principles of 3D computer graphics, but also the use of the OpenGL® Application Programming Interface (API) to code 3D scenes and animation, including games and movies. The undergraduate core of the book takes the student from zero knowledge of computer graphics to a mastery of the fundamental concepts with the ability to code applications using fourth-generation OpenGL®. The remaining chapters explore more advanced topics, including the structure of curves and surfaces, applications of projective spaces and transformations and the implementation of graphics pipelines. This book can be used for introductory undergraduate computer graphics courses over one to two semesters. The careful exposition style attempting to explain each concept in the simplest terms possible should appeal to the self-study student as well. Features Covers the foundations of 3D computer graphics, including animation, visual techniques and 3D modeling Comprehensive coverage of OpenGL® 4.x, including the GLSL and vertex, fragment, tessellation and geometry shaders Includes 180 programs with 270 experiments based on them Contains 750 exercises, 110 worked examples, and 700 four-color illustrations Requires no previous knowledge of computer graphics Balances theory with programming practice using a hands-on interacti
官网资源 ============================================================ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ============================================================ ================================= Apache Tomcat 7.0 Patch Proposals ================================= RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT: [ start all new proposals below, under PATCHES PROPOSED. ] PATCHES PROPOSED TO BACKPORT: [ New proposals should be added at the end of the list ] * https://bz.apache.org/bugzilla/show_bug.cgi?id=54330 Refactor Member interface to reduce dependency on concrete implementation. Based on a patch by Greg Turnquist. I have added this to the status file because it changes an interface. I don't believe there is any harm in this - the interface isn't really usable prior to this patch - but I'd prefer this change to be RTC. http://svn.apache.org/viewvc?rev=1430602&view=rev +1: markt, fhanik -1: * Back-port r1437083 from trunk. http://svn.apache.org/viewvc?view=revision&revision=1437083 Adds SSLContext.clearOptions method to allow clearing of SSL_OP_* options in OpenSSL. This will require tcnative 1.1.25 or errors may be thrown when a
官网资源 ================================================================================ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================================================ ================================= Apache Tomcat 7.0 Patch Proposals ================================= RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT: [ start all new proposals below, under PATCHES PROPOSED. ] PATCHES PROPOSED TO BACKPORT: [ New proposals should be added at the end of the list ] * https://bz.apache.org/bugzilla/show_bug.cgi?id=54330 Refactor Member interface to reduce dependency on concrete implementation. Based on a patch by Greg Turnquist. I have added this to the status file because it changes an interface. I don't believe there is any harm in this - the interface isn't really usable prior to this patch - but I'd prefer this change to be RTC. http://svn.apache.org/viewvc?rev=1430602&view=rev +1: markt, fhanik -1: * Back-port r1437083 from trunk. http://svn.apache.org/viewvc?view=revision&revision=1437083 Adds SSLContext.clearOptions method to allow clearing of SSL_OP_* options in OpenSSL. This will require tcnative 1.1.25 or errors may be thrown when attempting to call this method.
Title: Computer Graphics Through OpenGL: From Theory to Experiments, 3rd Edition--true PDF Author: Sumanta Guha Length: 760 pages Edition: 3 Language: English Publisher: Chapman and Hall/CRC Publication Date: 2019-01-07 ISBN-10: 1138612642 ISBN-13: 9781138612648 Description COMPREHENSIVE COVERAGE OF SHADERS AND THE PROGRAMMABLE PIPELINE From geometric primitives to animation to 3D modeling to lighting, shading and texturing, Computer Graphics Through OpenGL®: From Theory to Experiments is a comprehensive introduction to computer graphics which uses an active learning style to teach key concepts. Equally emphasizing theory and practice, the book provides an understanding not only of the principles of 3D computer graphics, but also the use of the OpenGL® Application Programming Interface (API) to code 3D scenes and animation, including games and movies. The undergraduate core of the book takes the student from zero knowledge of computer graphics to a mastery of the fundamental concepts with the ability to code applications using fourth-generation OpenGL®. The remaining chapters explore more advanced topics, including the structure of curves and surfaces, applications of projective spaces and transformations and the implementation of graphics pipelines. This book can be used for introductory undergraduate computer graphics courses over one to two semesters. The careful exposition style attempting to explain each concept in the simplest terms possible should appeal to the self-study student as well. Features Covers the foundations of 3D computer graphics, including animation, visual techniques and 3D modeling Comprehensive coverage of OpenGL® 4.x, including the GLSL and vertex, fragment, tessellation and geometry shaders Includes 180 programs with 270 experiments based on them Contains 750 exercises, 110 worked examples, and 700 four-color illustrations Requires no previous knowledge of computer graphics Balances theory with programming practice using a hands-on

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

赵小左

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值