mysql连接报java.math.BigInteger cannot be cast to java.lang.Long异常
使用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 就解决了。
----- ----- ----- ----- 谢谢大佬打赏----- ----- ----- ----- -----
李荣先辈Java简介 : https://www.cnblogs.com/Jomini/p/17030392.html
(转自:https://bbs.csdn.net/topics/392272603)(@KLOVEYY)