ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long on connect to MySQL

前端 未结 4 1294
野的像风
野的像风 2020-11-22 15:38

When connecting to MySQL, I get an error (see below).

Click here for code

I get this output:

run:
Now connecting to databse...

java.sql.SQLE         


        
4条回答
  •  天命终不由人
    2020-11-22 16:21

    For me updating the connector wasn't enough, I also had to complete my DriverManager.getConnection() url parameter with all the arguments, even if the error message was not mentionning this issue.

    In my case this parameters were needed : "jdbc:mysql://127.0.0.1:3306/database?zeroDateTimeBehavior=convertToNull&serverTimezone=UTC"

    Connector : mysql-connector-java-8.0.17.jar mysql version : 8.0.17

    Using java on netbeans.

提交回复
热议问题