2016-04-27 20 views
5

Viene visualizzato questo errore durante la connessione al database mysql con JDBC.Errore di connessione JDBC: fuso orario non riconosciuto

Database.getConnection() Error -->The server time zone value 'EEST' 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. 

Questo è il mio codice di connessione.

public static Connection getConnection(){ 
    try { 
     Class.forName("com.mysql.jdbc.Driver"); 

     Connection con = DriverManager.getConnection(
       "jdbc:mysql://localhost:3306/management", "root", "root"); 
     return con; 
    } catch (ClassNotFoundException | SQLException e) { 
     // TODO Auto-generated catch block 
     System.out.println("Database.getConnection() Error -->" 
       + e.getMessage()); 
     return null; 
    } 

} 
+0

Il messaggio di errore è sufficientemente chiaro. Cosa * precisamente * non capisci a riguardo? – Raedwald

+0

SO, hai provato a correggere il fuso orario del server? –

+1

Non ho trovato la proprietà di configurazione serverTimezone. – mcemilg

risposta

4

Penso che ci sia un problema con il fuso orario mismatch con Mysql e sistema. Quindi è meglio impostare il valore in sincronia. È inoltre possibile fare riferimento al collegamento seguente per impostare l'ora: How do I set the time zone of MySQL?