ClassCastException:java.math.BigInteger在连接MySQL时无法强制转换为java.lang.Long
连接到MySQL时,出现错误(见下文)。
点击这里查看代码
我得到这个输出:
run:Now connecting to databse...java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Longjava.sql.SQLException: java.lang.ClassCastException: 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) at com.mysql.jdbc.ConnectionImpl.buildCollationMapping(ConnectionImpl.java:1062) at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3556) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2513) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2283) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:822) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:404) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:317) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at dbms_basic.Dbms_Basic.main(Dbms_Basic.java:28)Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
我怎么解决这个问题?