configure time zone JDBC driver java

0

I present an error when executing my code from the persistence part which is the following

Exception in thread "AWT-EventQueue-0" javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: The server time zone value 'Hora est. Pac?fico, Sudam?ric' 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.

Where is the time zone configured to solve this problem?

I use the following mysql driver

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>6.0.5</version>
        </dependency>
    
asked by Sergio Guerrero 11.02.2017 в 04:55
source

1 answer

6

You can configure it in the URL of the connection:

jdbc:mysql://localhost/db?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC

Here the answer in English

Although I believe, as the SQL error recommends, that you should configure MySQL to accept only the English language and the encoding in ISO-8859-1 to allow characters such as ñ when trying to insert VARCHARS and not corrupt your data.

    
answered by 11.02.2017 / 08:04
source