int maxLength = 23;
int maxLength = 22;
    public void testTimestampWithCalendar() throws Exception {        Properties props = new Properties();        props.putAll(getDefaultPropertiesForConnection());        props.setProperty("timestamp_uses_local_timezone", "");                Connection connection = DriverManager.getConnection(getUrl(), props);        try {            PreparedStatement stmt = connection.prepareStatement(                "INSERT INTO test_blob(id, ts_field) VALUES (?, ?)");                        try {                Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT+01"));                Calendar utcCalendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));                                Timestamp ts = new Timestamp(calendar.getTime().getTime());                stmt.setInt(1, 2);                stmt.setTimestamp(2, ts, calendar);                                stmt.execute();                stmt.setInt(1, 3);                stmt.setTimestamp(2, ts, utcCalendar);                                stmt.execute();                                                Statement selectStmt = connection.createStatement();                try {                    ResultSet rs = selectStmt.executeQuery(                        "SELECT id, CAST(ts_field AS VARCHAR(30)), ts_field FROM test_blob");                                        Timestamp ts2 = null;                    Timestamp ts3 = null;                                        String ts2Str = null;                    String ts3Str = null;                                        int maxLength = 23;                                        // workaround for the bug in java.sql.Timestamp in JDK 1.3                     if ("1.3".equals(System.getProperty("java.specification.version")))                        maxLength = 19;                                        while(rs.next()) {                                                switch(rs.getInt(1)) {                            case 2 :                                ts2 = rs.getTimestamp(3);                                ts2Str = rs.getString(2).substring(0, maxLength);                                break;                                                            case 3 :                                 ts3 = rs.getTimestamp(3);                                ts3Str = rs.getString(2).substring(0, maxLength);                                break;                        }                    }                                        assertTrue("Timestamps 2 and 3 should differ for 3600 seconds.",                        Math.abs(ts2.getTime() - ts3.getTime()) == 3600*1000);                                        assertTrue("Server should see the same timestamp",                        ts2.toString().substring(0, maxLength).equals(ts2Str));                    assertTrue("Server should see the same timestamp",                        ts3.toString().substring(0, maxLength).equals(ts3Str));                } finally {                    selectStmt.close();                }                            } finally {                stmt.close();            }                    } finally {            connection.close();        }    }