有没有朋友帮我解决一下为什么连接不上数据库呀 eclipse报错就是这样的 要交

问题描述:

java.math.BigInteger cannot be cast to java.lang.Long
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
at com.mysql.jdbc.ConnectionImpl.buildCollationMapping(ConnectionImpl.java:992)
... 38 more

数据库配置信息看一下。

java.math.BigInteger不能转换为java.lang.Long
这是你的报错信息,你在仔细看看

找找你的代码报错行数是哪一行,而不是jdbc包 报错在哪一行, 然后 看看 是不是 用了 强制类型转换(或者是 直接 用 Long类型的变量 接了 BigIntiger类型的返回值) ,把强制类型转换 换成 .longValue
例如:
BigInteger bigA = new BigInteger("1");
Long longA = bigA.longValue();