getTimestamp()在MySQL JDBC连接器中进行两次时区转换?

我在MySQL数据库中有一个类型为DATETIME的列,其值为2012-05-07 19:59:12 。 我正在尝试从DB中检索此值,假设它存储在UTC时区中:

 Calendar cal = Calendar.getInstance(new SimpleTimeZone(0, "UTC")); Date date = resultSet.getTimestamp(1, cal); System.out.println(date); 

它输出( CEST是我当地的时区,比UTC早2小时):

 Mon May 07 23:59:12 CEST 2012 

预期价值是:

 Mon May 07 21:59:12 CEST 2012 

我在JDBC URL中使用这三个参数( Europe/BerlinCEST相同):

 ..&useGmtMillisForDatetimes=true&useTimezone=true&serverTimezone=Europe/Berlin 

是我的缺陷还是应该在JDBC驱动程序中另外配置的东西? 我正在使用mysql:mysql-connector-java:5.1.20

使用这些JDBC URL参数,它可以工作:

 useGmtMillisForDatetimes=true useJDBCCompliantTimezoneShift=true useLegacyDate‌timeCode=false useTimezone=true serverTimezone=UTC