今天遇见这样一个坑。在连接数据库进行查询数据时,大家可能会遇见这样一个问题: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. spoj Longest Common Substring

    Longest Common Substring SPOJ - LCS 题意:求两个串的最长公共子串 /* 对一个串建立后缀自动机,用另一个串上去匹配 */ #include<iostream& ...

  2. vm安装centos后unknown host问题和yum install安装不成功问题

    网上差了很多说要在vi /etc/sysconfig/network新增GATEWAY=192.168.0.1 还有vi /etc/sysconfig/network-scripts/ifcfg-et ...

  3. IDEA总是启动不了

    时常怎么都打不开这个软件,或者很久很久才打开. 解决办法:在任务管理器将IDEA结束进程,再去打开软件,就可以了.

  4. firefox浏览本地网站慢的问题

    用火狐调试本地站点网站,总感觉有点迟钝 经查,原来是火狐会检测网站来源,具体工作原理不详 解决办法 依次打开:C:\Windows\System32\drivers\etc 用记事本或editplus ...

  5. 【Groovy】Spock with Maven

    已经在项目里使用Groovy/Spock做测试框架了,感觉和Maven结合在一起还是挺好用的. 在Maven的pom.xml里引入他们还是挺方便的,第一先要在dependency 里引入 <de ...

  6. Navicat12破解

    Navicat12破解 http://www.sdbeta.com/xiazai/2017/0818/209765.html

  7. Android MVP模式实现组件和业务逻辑分离

    1,Activity代码展示,只需要一下3行重要代码即可完成任何复杂的逻辑 /** * 登录界面 * * @author lipanquan */public class LoginActivity ...

  8. python模块之openpyxl扩展

    主要是对openpyxl扩展进行扩展,使用归类等 1. 安装 pip install openpyxl 想要在文件中插入图片文件,需要安装pillow,安装文件:PIL-fork-1.1.7.win- ...

  9. beeline hiveserver2 start

    1. install hive 2. start hiveserver2 查看hiverserver2 是否正常运行: ps -ef | grep hive 2. start beeline 3. 链 ...

  10. ubuntu hadoop集群 master免密码登陆到slave节点

    1. 在master节点上安装ssh client,在slave节点上安装ssh server sudo apt-get install openssh-client sudo apt-get ins ...