今天遇见这样一个坑。在连接数据库进行查询数据时,大家可能会遇见这样一个问题:java.math.BigInteger cannot be cast to java.lang.Long,然后去检查代码中的类型为Long,接着检查数据表中字段的类型为bigint,按道理类型是匹配的啊,那么问题到底出现在哪儿呢?

  如果出现以上问题,大家就应该注意了,是不是数据库版本与mysql-connector.jar包的版本不兼容造成的。本人用的是Mysql8.0.12免安装版本,出现问题时的jar包版本为5.1.26,更换为5.1.47后解决了该问题。希望能够帮助到遇到这类问题的朋友。

连接Mysql时出现java.math.BigInteger cannot be cast to java.lang.Long问题的更多相关文章

  1. mysql连接报java.math.BigInteger cannot be cast to java.lang.Long异常

    使用hibernate出现以下错误 java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot b ...

  2. 【问题解决:连接异常】 java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long

    问题描述: MySQL更新到8.0.11之后连接数据库时会报出错误 Your login attempt was not successful, try again.Reason: Could not ...

  3. Spring boot启动时报 java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long错误

    Spring boot启动时报 java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be ...

  4. 初学MyBatis(踩坑)Error querying database. Cause: java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long

    最近在学习Mybatis,代码全部根据教程写好了,一运行结果报了一个错误,主要错误内容: Caused by: org.apache.ibatis.exceptions.PersistenceExce ...

  5. [记录]java.math.biginteger cannot be cast to java.lang.long

    可以直接使用BigInteger类型进行接收, BigInteger id = (BigInteger)QueryRunner(conn,"SELECT LAST_INSERT_ID&quo ...

  6. 【添加最新版本的mysql的jdbc连接jar包】java.math.BigInteger cannot be cast to java.lang.Long异常

    [问题描述] 从我的电脑把项目拷贝到guo小中的win8电脑,but出现了那个错误,估计他的mysql是最新版本的. [如何下载连接jar包] 链接:https://pan.baidu.com/s/1 ...

  7. MySQL分段统计SQL写法 与 Mybatis 异常 java.math.BigDecimal cannot be cast to java.lang.Integer

    mysql> select end) as '<60', end) as '60~69', end) as '70~79', end) as '80~89', end) as '>= ...

  8. 数据转换bug花了半天时间 Java.math.BigDecimal cannot be cast to java.lang.String

    从数据库取出一个 Count函数 统计的值 在代码中要转成Integer类型的时候 Integer.parseInt((String)map.get("ID_")) 报了一下错误: ...

  9. 数据转换失败 java.math.BigDecimal cannot be cast to java.lang.String

    从接口获取到数据,在转换的时候出现错误:java.math.BigDecimal cannot be cast to java.lang.String 因为一开始用的是使用关键字进行强制转换,后来发现 ...

随机推荐

  1. P4799 [CEOI2015 Day2]世界冰球锦标赛

    \(\color{#0066ff}{题目描述}\) 今年的世界冰球锦标赛在捷克举行.Bobek 已经抵达布拉格,他不是任何团队的粉丝,也没有时间观念.他只是单纯的想去看几场比赛.如果他有足够的钱,他会 ...

  2. cmake相关问题

    一.cmake升级 在ubuntu 16.04下面把cmake 由 3.5.1升级到 3.11,具体的流程如下所述. (1) sudo apt-get install build-essential ...

  3. 项目笔记《DeepLung:Deep 3D Dual Path Nets for Automated Pulmonary Nodule Detection and Classification》(一)预处理

    最近一个月都在做肺结节的检测,学到了不少东西,运行的项目主要是基于这篇论文,在github上可以查到项目代码. 我个人总结的肺结节检测可以分为三个阶段,数据预处理,网络搭建及训练,结果评估. 这篇博客 ...

  4. 解决SharePoint2013产品过期问题

    作者:huangtao2011 引用:http://blog.csdn.net/huangtao2011/article/details/27528101 今天使用SharePoint 2013创建页 ...

  5. 读经典——《CLR via C#》(Jeffrey Richter著) 笔记_8.1实例构造器和类A

    public class SomeType { } //等价于 public class SomeType { public SomeType():base(){} } [解释]如果定义的类没有显示定 ...

  6. Margarite and the best present

    Little girl Margarita is a big fan of competitive programming. She especially loves problems about a ...

  7. 74th LeetCode Weekly Contest Preimage Size of Factorial Zeroes Function

    Let f(x) be the number of zeroes at the end of x!. (Recall that x! = 1 * 2 * 3 * ... * x, and by con ...

  8. Codeforces Round #305 (Div. 2) B

    Description Mike and some bears are playing a game just for fun. Mike is the judge. All bears except ...

  9. NYOJ144_小珂的苦恼_C++

    题目:http://acm.nyist.net/JudgeOnline/problem.php?pid=144 用扩展欧几里得定理判断是否有解即可,然后记得打上读入优化 扩展欧几里得算法:http:/ ...

  10. http 和 https 的区别

    参考:http://www.cnblogs.com/wqhwe/p/5407468.html HTTP:是互联网上应用最为广泛的一种网络协议,是一个客户端和服务器端请求和应答的标准(TCP),用于从W ...