2016-08-22 92 views
0

不管我做什么改变或者phpmyadmin的或在persistence.xml中ConnectionString中的时区,我得到这个错误:JPA和服务器时区错误

com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: 
The server time zone value 'Romance Summer Time' 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. 

这是我的persistence.xml:

<persistence-unit name="booking" transaction-type="RESOURCE_LOCAL"> 
     <properties> 
      <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/> 
      <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost/_boekingdb_/> 
      <property name="javax.persistence.jdbc.user" value="root"/> 
      <property name="javax.persistence.jdbc.password" value=""/> 
      <property name="hibernate.show_sql" value="true"/> 
     </properties> 
    </persistence-unit> 

添加

?useUnicode=true&amp;useJD‌​BCCompliantTimezoneS‌​hift=true&amp;useLeg‌​acyDatetimeCode=fals‌​e&amp;serverTimezone‌​=UTC" 

到jdbc.url的ConnectionString什么都不做

我甚至不知道这个'浪漫夏日时光'来自何处。

任何帮助,将不胜感激

回答

0

简单地增加

default-time-zone=+00:00 

到MY.INI(在XAMP \ mysql的\ BIN)固定一切...