再用jdbc链接mysql数据库时,我用的connector是5.1.21版本,然后就会报错
java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
我是这么解决的
由于jar包和mysql版本冲突,然后就把pom.xml文件中connector版本换成5.1.46,就不会报错了
然后又爆黄(warn)
Sun Aug 07 11:02:04 CST 2022 WARN: Establishing SSL connection without server's identity
verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+
requirements SSL connection must be established by default if explicit option isn't set.
For compliance with existing applications not using SSL the verifyServerCertificate
property is set to 'false'. You need either to explicitly disable SSL by setting
useSSL=false, or set useSSL=true and provide truststore for server certificate
verification.
发现是关于SSL的东西,解决方法在他报错的文字中就有,For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false。 就是在jdbc连接的链接后面加上?useSSL=false
datasource:
url: jdbc:mysql://localhost:3306/user?useSSL=false
username: root
password: root
driver-class-name: com.mysql.jdbc.Driver