使用hibernate出现以下错误

java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
at com.mysql.jdbc.ConnectionImpl.buildCollationMapping(ConnectionImpl.java:1074)
at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3590)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2531)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2301)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:317)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at zttc.itat.user.util.DbUtil.getConnection(DbUtil.java:12)
at zttc.itat.user.util.AbstractDbUnitTestCase.init(AbstractDbUnitTestCase.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

后来将 mysql-connector-java-5.1.24.jar 换成了mysql-connector-java-5.1.46.jar 就解决了。

----- ----- ----- ----- 谢谢大佬打赏----- ----- ----- ----- ----- 

(转自:https://bbs.csdn.net/topics/392272603)(@KLOVEYY

mysql连接报java.math.BigInteger cannot be cast to java.lang.Long异常的更多相关文章

  1. 连接Mysql时出现java.math.BigInteger cannot be cast to java.lang.Long问题

    今天遇见这样一个坑.在连接数据库进行查询数据时,大家可能会遇见这样一个问题:java.math.BigInteger cannot be cast to java.lang.Long,然后去检查代码中 ...

  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. 数据转换失败 java.math.BigDecimal cannot be cast to java.lang.String

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

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

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

随机推荐

  1. 第十六节、特征描述符BRIEF(附源码)

    我们已经知道SIFT算法采用128维的特征描述子,由于描述子用的是浮点数,所以它将会占用512字节的空间.类似的SUFR算法,一般采用64维的描述子,它将占用256字节的空间.如果一幅图像中有1000 ...

  2. 第五节,Neural Networks and Deep Learning 一书小节(中)

    在这一节,我们对上一个程序(Network1.py)进行了优化 3.改进神经网络的学习方法 (1)交叉熵代价函数的引入 Network1程序采用了S型神经元,S型神经元存在一个问题,当输出层神经元的输 ...

  3. JVM与GC

    1.JVM的内存分配参考文章: https://www.cnblogs.com/wangjzh/p/5258254.html 2. java之GC https://www.cnblogs.com/hn ...

  4. (BFS) leetcode 690. Employee Importance

    690. Employee Importance Easy 377369FavoriteShare You are given a data structure of employee informa ...

  5. (栈)leetcode496. Next Greater Element I

    You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of n ...

  6. (等比数列)P1423 小玉在游泳 洛谷

    题目描述 小玉开心的在游泳,可是她很快难过的发现,自己的力气不够,游泳好累哦.已知小玉第一步能游2米,可是随着越来越累,力气越来越小,她接下来的每一步都只能游出上一步距离的98%.现在小玉想知道,如果 ...

  7. https服务器配置部署

    现在很多网站都要是https,包括我之前做的微信小程序都是需要使用https传输的,特将之前学习的记录下,以防忘记 一. 1.HTTPS简介 HTTPS其实是有两部分组成:HTTP + SSL / T ...

  8. 关于indexOf,charAt,subString的区别

    @Test public void indexOf() { // 注意:在Unicode表中A-Z的十进制对应:65-90 // a-z的进制对应:97-122 // 0-9的十进制对应:48-57 ...

  9. qml Loader异步导致ComBoBox数据乱序

    qml  Loader异步导致ComBoBox数据乱序 当使用Loader动态加载qml文件时, 如果将Loader设置为异步,那么动态加载的组件内的ComBoBox数据将呈现乱序状态, 代码请见下文 ...

  10. 《玩转Django2.0》读书笔记-Django建站基础

    <玩转Django2.0>读书笔记-Django建站基础 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.网站的定义及组成 网站(Website)是指在因特网上根据一 ...