Home >Database >Mysql Tutorial >Why Can't I Connect to MySQL Due to a `ClassCastException: java.math.BigInteger Cannot Be Cast to java.lang.Long`?
Problem:
When attempting to connect to a MySQL database using Java, an error occurs:
java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
Answer:
This error indicates an issue with the casting of a java.math.BigInteger object to a java.lang.Long object during the connection process. It suggests a mismatch between your MySQL version and the version of the mysql-connector.jar library.
Solution:
To resolve this issue, follow these steps:
The above is the detailed content of Why Can't I Connect to MySQL Due to a `ClassCastException: java.math.BigInteger Cannot Be Cast to java.lang.Long`?. For more information, please follow other related articles on the PHP Chinese website!