其实这两个问题我都有遇到,并且是用同一个方法解决了,我们来看看
第一个问题:在Eclipse中对Maven项目使用Mybatis自动生成代码,结果有下面的错误提示:
Cannot obtain primary key information from the database,generated objects may be incomplete
翻译:无法从数据库中获取主键信息,生成的对象可能不完整
第二个问题:
The server time zone value '�й���ʱ��' is unrecognized or represents more
than one time zone. You must configure either the server or JDBC driver
(via the serverTimezone configuration property) to use a more specifc time
zone value if you want to utilize time zone support.
翻译:服务器时区值' й '无法识别或代表多个时区。 如果要使用时区支持,则必须配置服务器或JDBC驱动程序(通过serverTimezone配置属性)以使用更具体的时区值。
解决方案:
找到如下路径中的generatorConfig.xml文件
修改如下代码
<!--数据库链接URL,用户名、密码 -->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
connectionURL="jdbc:mysql://39.106.193.131:3306/carproject"
userId="root" password="123456">
</jdbcConnection>
修改为
<!--数据库链接URL,用户名、密码 -->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
connectionURL="jdbc:mysql://39.106.193.131:3306/carproject?serverTimezone=UTC "
userId="root" password="123456">
</jdbcConnection>
我的问题就是这样解决的
但如果你的数据库链接URL类似下面:
jdbcUrl=jdbc:mysql://localhost:3306/spring?serverTimezone=UTC&characterEncoding=utf-8
就是有多个params的时候需要以&分开,但&要改为& 如下:
jdbcUrl=jdbc:mysql://localhost:3306/spring?serverTimezone=UTC&characterEncoding=utf-8
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有