You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2010/04/20 12:56:16 UTC

svn commit: r935868 - in /db/derby/code/trunk/java/client/org/apache/derby/client: am/DateTime.java am/DateTimeValue.java am/PreparedStatement.java net/NetStatementRequest.java net/Request.java

Author: kahatlen
Date: Tue Apr 20 10:56:16 2010
New Revision: 935868

URL: http://svn.apache.org/viewvc?rev=935868&view=rev
Log:
DERBY-4582: Timestamps inserted with GMT calendar are 1 hour later
when subsequently read with GMT calendar (Server Mode Only)

Partial fix. This check-in makes the client do the conversion to the
requested time zone correctly, and the correct timestamps will be sent
to the server. There's still some incorrect handling of the values on
the server, as well as when the client reads them back from the
server, so the results may still end up being wrong.

Added:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/DateTimeValue.java   (with props)
Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/DateTime.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementRequest.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/DateTime.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/DateTime.java?rev=935868&r1=935867&r2=935868&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/DateTime.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/DateTime.java Tue Apr 20 10:56:16 2010
@@ -264,16 +264,16 @@ public class DateTime {
      */
     public static final int dateToDateBytes(byte[] buffer,
                                             int offset,
-                                            java.sql.Date date) 
+                                            DateTimeValue date)
     throws SqlException,UnsupportedEncodingException {
-        int year = date.getYear() + 1900;
+        int year = date.getYear();
         if (year > 9999) {
             throw new SqlException(null,
                 new ClientMessageId(SQLState.YEAR_EXCEEDS_MAXIMUM),
                 new Integer(year), "9999");
         }
         int month = date.getMonth() + 1;
-        int day = date.getDate();
+        int day = date.getDayOfMonth();
 
         char[] dateChars = new char[DateTime.dateRepresentationLength];
         int zeroBase = (int) '0';
@@ -311,7 +311,7 @@ public class DateTime {
      */
     public static final int timeToTimeBytes(byte[] buffer,
                                             int offset,
-                                            java.sql.Time time)
+                                            DateTimeValue time)
     throws UnsupportedEncodingException {
         int hour = time.getHours();
         int minute = time.getMinutes();
@@ -350,17 +350,17 @@ public class DateTime {
      */
     public static final int timestampToTimestampBytes(byte[] buffer,
                                                       int offset,
-                                                      java.sql.Timestamp timestamp,
+                                                      DateTimeValue timestamp,
                                                       boolean supportsTimestampNanoseconds) 
     throws SqlException,UnsupportedEncodingException {
-        int year = timestamp.getYear() + 1900;
+        int year = timestamp.getYear();
         if (year > 9999) {
             throw new SqlException(null,
                 new ClientMessageId(SQLState.YEAR_EXCEEDS_MAXIMUM),
                 new Integer(year), "9999");
         }
         int month = timestamp.getMonth() + 1;
-        int day = timestamp.getDate();
+        int day = timestamp.getDayOfMonth();
         int hour = timestamp.getHours();
         int minute = timestamp.getMinutes();
         int second = timestamp.getSeconds();

Added: db/derby/code/trunk/java/client/org/apache/derby/client/am/DateTimeValue.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/DateTimeValue.java?rev=935868&view=auto
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/DateTimeValue.java (added)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/DateTimeValue.java Tue Apr 20 10:56:16 2010
@@ -0,0 +1,180 @@
+/*
+ * Derby - Class org.apache.derby.client.am.DateTimeValue
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.derby.client.am;
+
+import java.sql.Date;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+/**
+ * This class represents a date or time value as it is represented in the
+ * database. In contrast to {@code java.sql.Date}, {@code java.sql.Time} and
+ * {@code java.sql.Timestamp}, which are based on {@code java.util.Date}, this
+ * class does <b>not</b> represent the time as an offset from midnight,
+ * January 1, 1970 GMT. Instead, it holds each component (year, month, day,
+ * hour, minute, second, nanosecond) as it would have been represented in a
+ * given calendar. Since it does not hold information about the time zone for
+ * the time it represents, it does not point to a well-defined point in time
+ * without being used together with a {@code java.util.Calendar} object.
+ */
+public class DateTimeValue {
+    private final int year;
+    private final int month;
+    private final int day;
+    private final int hours;
+    private final int minutes;
+    private final int seconds;
+    private final int nanos;
+
+    /**
+     * Construct a {@code DateTimeValue} from a {@code java.util.Calendar}.
+     *
+     * @param cal the calendar from which to get the values of the fields
+     * @param nanoFraction the nano second fraction of a second (the
+     * milliseconds will be taken from {@code cal}, so only the six least
+     * significant digits of this value are used)
+     */
+    private DateTimeValue(Calendar cal, int nanoFraction) {
+        year = cal.get(Calendar.YEAR);
+        month = cal.get(Calendar.MONTH);
+        day = cal.get(Calendar.DAY_OF_MONTH);
+        hours = cal.get(Calendar.HOUR_OF_DAY);
+        minutes = cal.get(Calendar.MINUTE);
+        seconds = cal.get(Calendar.SECOND);
+
+        // In practice, we could probably just use nanoFraction directly here,
+        // when it's set but since java.util.Calendar allows time zone offsets
+        // to be specified in milliseconds, let's get the time zone adjusted
+        // millisecond component too.
+        int millis = cal.get(Calendar.MILLISECOND);
+        nanos = (millis * 1000000) + (nanoFraction % 1000000);
+    }
+
+    /**
+     * Create an instance from a {@code java.sql.Timestamp} using the specified
+     * {@code java.util.Calendar}.
+     */
+    public DateTimeValue(Date date, Calendar cal) {
+        this(initCalendar(cal, date), 0);
+    }
+
+    /**
+     * Create an instance from a {@code java.sql.Time} using the specified
+     * {@code java.util.Calendar}.
+     */
+    public DateTimeValue(Time time, Calendar cal) {
+        this(initCalendar(cal, time), 0);
+    }
+
+    /**
+     * Create an instance from a {@code java.sql.Timestamp} using the specified
+     * {@code java.util.Calendar}.
+     */
+    public DateTimeValue(Timestamp ts, Calendar cal) {
+        this(initCalendar(cal, ts), ts.getNanos());
+    }
+
+    /**
+     * Create an instance from a {@code java.sql.Date} using the default
+     * calendar.
+     */
+    public DateTimeValue(Date date) {
+        this(date, Calendar.getInstance());
+    }
+
+    /**
+     * Create an instance from a {@code java.sql.Time} using the default
+     * calendar.
+     */
+    public DateTimeValue(Time time) {
+        this(time, Calendar.getInstance());
+    }
+
+    /**
+     * Create an instance from a {@code java.sql.Timestamp} using the default
+     * calendar.
+     */
+    public DateTimeValue(Timestamp ts) {
+        this(ts, Calendar.getInstance());
+    }
+
+    /**
+     * Set the time of a calendar.
+     *
+     * @param cal the calendar
+     * @param date an object representing the new time of the calendar
+     * @return the calendar (same as {@code cal})
+     */
+    private static Calendar initCalendar(Calendar cal, java.util.Date date) {
+        cal.clear();
+        cal.setTime(date);
+        return cal;
+    }
+
+    /**
+     * Get the year component.
+     */
+    public int getYear() {
+        return year;
+    }
+
+    /**
+     * Get the month component. First month is 0 ({@code Calendar.JANUARY}).
+     */
+    public int getMonth() {
+        return month;
+    }
+
+    /**
+     * Get day of month component. First day of the month is 1.
+     */
+    public int getDayOfMonth() {
+        return day;
+    }
+
+    /**
+     * Get hour of day component (24 hour clock).
+     */
+    public int getHours() {
+        return hours;
+    }
+
+    /**
+     * Get minute component.
+     */
+    public int getMinutes() {
+        return minutes;
+    }
+
+    /**
+     * Get second component.
+     */
+    public int getSeconds() {
+        return seconds;
+    }
+
+    /**
+     * Get nanosecond component.
+     */
+    public int getNanos() {
+        return nanos;
+    }
+}

Propchange: db/derby/code/trunk/java/client/org/apache/derby/client/am/DateTimeValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java?rev=935868&r1=935867&r2=935868&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java Tue Apr 20 10:56:16 2010
@@ -27,9 +27,13 @@ import org.apache.derby.iapi.services.sa
 
 import java.io.InputStream;
 import java.io.Reader;
+import java.sql.Date;
 import java.sql.SQLException;
+import java.sql.Time;
+import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Calendar;
 import org.apache.derby.client.ClientPooledConnection;
 import org.apache.derby.jdbc.ClientDriver;
 
@@ -718,12 +722,14 @@ public class PreparedStatement extends S
         }
     }
 
-    public void setDate(int parameterIndex, java.sql.Date x) throws SQLException {
+    public void setDate(int parameterIndex, Date x, Calendar calendar)
+            throws SQLException {
         try
         {
             synchronized (connection_) {
                 if (agent_.loggingEnabled()) {
-                    agent_.logWriter_.traceEntry(this, "setDate", parameterIndex, x);
+                    agent_.logWriter_.traceEntry(
+                            this, "setDate", parameterIndex, x, calendar);
                 }
                 
                 final int paramType = 
@@ -738,12 +744,19 @@ public class PreparedStatement extends S
                 }
                 
                 checkForClosedStatement();
+
+                if (calendar == null) {
+                    throw new SqlException(agent_.logWriter_,
+                        new ClientMessageId(SQLState.INVALID_API_PARAMETER),
+                        "null", "calendar", "setDate()");
+                }
+
                 parameterMetaData_.clientParamtertype_[parameterIndex - 1] = java.sql.Types.DATE;
                 if (x == null) {
                     setNull(parameterIndex, java.sql.Types.DATE);
                     return;
                 }
-                setInput(parameterIndex, x);
+                setInput(parameterIndex, new DateTimeValue(x, calendar));
             }
         }
         catch ( SqlException se )
@@ -752,41 +765,12 @@ public class PreparedStatement extends S
         }
     }
 
-    public void setDate(int parameterIndex,
-                        java.sql.Date x,
-                        java.util.Calendar calendar) throws SQLException {
-        try
-        {
-            synchronized (connection_) {
-                if (agent_.loggingEnabled()) {
-                    agent_.logWriter_.traceEntry(this, "setDate", parameterIndex, x, calendar);
-                }
-                checkForClosedStatement();
-                if (calendar == null) {
-                    throw new SqlException(agent_.logWriter_, 
-                        new ClientMessageId(SQLState.INVALID_API_PARAMETER),
-                        "null", "calendar", "setDate");
-                }
-                java.util.Calendar targetCalendar = java.util.Calendar.getInstance(calendar.getTimeZone());
-                targetCalendar.clear();
-                targetCalendar.setTime(x);
-                java.util.Calendar defaultCalendar = java.util.Calendar.getInstance();
-                defaultCalendar.clear();
-                defaultCalendar.setTime(x);
-                long timeZoneOffset =
-                        targetCalendar.get(java.util.Calendar.ZONE_OFFSET) - defaultCalendar.get(java.util.Calendar.ZONE_OFFSET) +
-                        targetCalendar.get(java.util.Calendar.DST_OFFSET) - defaultCalendar.get(java.util.Calendar.DST_OFFSET);
-                java.sql.Date adjustedDate = ((timeZoneOffset == 0) || (x == null)) ? x : new java.sql.Date(x.getTime() + timeZoneOffset);
-                setDate(parameterIndex, adjustedDate);
-            }
-        }
-        catch ( SqlException se )
-        {
-            throw se.getSQLException();
-        }
+    public void setDate(int parameterIndex, Date x) throws SQLException {
+        setDate(parameterIndex, x, Calendar.getInstance());
     }
 
-    public void setTime(int parameterIndex, java.sql.Time x) throws SQLException {
+    public void setTime(int parameterIndex, Time x, Calendar calendar)
+            throws SQLException {
         try
         {
             synchronized (connection_) {
@@ -804,12 +788,18 @@ public class PreparedStatement extends S
                                                        paramType );
                 }
                 
+                if (calendar == null) {
+                    throw new SqlException(agent_.logWriter_,
+                        new ClientMessageId(SQLState.INVALID_API_PARAMETER),
+                        "null", "calendar", "setTime()");
+                }
+
                 parameterMetaData_.clientParamtertype_[parameterIndex - 1] = java.sql.Types.TIME;
                 if (x == null) {
                     setNull(parameterIndex, java.sql.Types.TIME);
                     return;
                 }
-                setInput(parameterIndex, x);
+                setInput(parameterIndex, new DateTimeValue(x, calendar));
 
             }
         }
@@ -819,41 +809,12 @@ public class PreparedStatement extends S
         }
     }
 
-    public void setTime(int parameterIndex,
-                        java.sql.Time x,
-                        java.util.Calendar calendar) throws SQLException {
-        try
-        {
-            synchronized (connection_) {
-                if (agent_.loggingEnabled()) {
-                    agent_.logWriter_.traceEntry(this, "setTime", parameterIndex, x, calendar);
-                }
-                checkForClosedStatement();
-                if (calendar == null) {
-                    throw new SqlException(agent_.logWriter_,
-                        new ClientMessageId(SQLState.INVALID_API_PARAMETER),
-                        "null", "calendar", "setTime()");
-                }
-                java.util.Calendar targetCalendar = java.util.Calendar.getInstance(calendar.getTimeZone());
-                targetCalendar.clear();
-                targetCalendar.setTime(x);
-                java.util.Calendar defaultCalendar = java.util.Calendar.getInstance();
-                defaultCalendar.clear();
-                defaultCalendar.setTime(x);
-                long timeZoneOffset =
-                        targetCalendar.get(java.util.Calendar.ZONE_OFFSET) - defaultCalendar.get(java.util.Calendar.ZONE_OFFSET) +
-                        targetCalendar.get(java.util.Calendar.DST_OFFSET) - defaultCalendar.get(java.util.Calendar.DST_OFFSET);
-                java.sql.Time adjustedTime = ((timeZoneOffset == 0) || (x == null)) ? x : new java.sql.Time(x.getTime() + timeZoneOffset);
-                setTime(parameterIndex, adjustedTime);
-            }
-        }
-        catch ( SqlException se )
-        {
-            throw se.getSQLException();
-        }
+    public void setTime(int parameterIndex, Time x) throws SQLException {
+        setTime(parameterIndex, x, Calendar.getInstance());
     }
 
-    public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws SQLException {
+    public void setTimestamp(int parameterIndex, Timestamp x, Calendar calendar)
+            throws SQLException {
         try
         {
             synchronized (connection_) {
@@ -872,16 +833,19 @@ public class PreparedStatement extends S
                     
                 }
                 
+                if (calendar == null) {
+                    throw new SqlException(agent_.logWriter_,
+                        new ClientMessageId(SQLState.INVALID_API_PARAMETER),
+                        "null", "calendar", "setTimestamp()");
+                }
+
                 parameterMetaData_.clientParamtertype_[parameterIndex - 1] = java.sql.Types.TIMESTAMP;
 
                 if (x == null) {
                     setNull(parameterIndex, java.sql.Types.TIMESTAMP);
                     return;
                 }
-                setInput(parameterIndex, x);
-                // once the nanosecond field of timestamp is trim to microsecond for DERBY, should we throw a warning
-                //if (getParameterType (parameterIndex) == java.sql.Types.TIMESTAMP && x.getNanos() % 1000 != 0)
-                //  accumulateWarning (new SqlWarning (agent_.logWriter_, "DERBY timestamp can only store up to microsecond, conversion from nanosecond to microsecond causes rounding."));
+                setInput(parameterIndex, new DateTimeValue(x, calendar));
             }
         }
         catch ( SqlException se )
@@ -890,41 +854,9 @@ public class PreparedStatement extends S
         }
     }
 
-    public void setTimestamp(int parameterIndex,
-                             java.sql.Timestamp x,
-                             java.util.Calendar calendar) throws SQLException {
-        try
-        {
-            synchronized (connection_) {
-                if (agent_.loggingEnabled()) {
-                    agent_.logWriter_.traceEntry(this, "setTimestamp", parameterIndex, x, calendar);
-                }
-                checkForClosedStatement();
-                if (calendar == null) {
-                    throw new SqlException(agent_.logWriter_, 
-                        new ClientMessageId(SQLState.INVALID_API_PARAMETER),
-                        "null", "calendar", "setTimestamp()");
-                }
-                java.util.Calendar targetCalendar = java.util.Calendar.getInstance(calendar.getTimeZone());
-                targetCalendar.clear();
-                targetCalendar.setTime(x);
-                java.util.Calendar defaultCalendar = java.util.Calendar.getInstance();
-                defaultCalendar.clear();
-                defaultCalendar.setTime(x);
-                long timeZoneOffset =
-                        targetCalendar.get(java.util.Calendar.ZONE_OFFSET) - defaultCalendar.get(java.util.Calendar.ZONE_OFFSET) +
-                        targetCalendar.get(java.util.Calendar.DST_OFFSET) - defaultCalendar.get(java.util.Calendar.DST_OFFSET);
-                java.sql.Timestamp adjustedTimestamp = ((timeZoneOffset == 0) || (x == null)) ? x : new java.sql.Timestamp(x.getTime() + timeZoneOffset);
-                if (x != null) {
-                    adjustedTimestamp.setNanos(x.getNanos());
-                }
-                setTimestamp(parameterIndex, adjustedTimestamp);
-            }
-        }
-        catch ( SqlException se )
-        {
-            throw se.getSQLException();
-        }
+    public void setTimestamp(int parameterIndex, Timestamp x)
+            throws SQLException {
+        setTimestamp(parameterIndex, x, Calendar.getInstance());
     }
 
     public void setString(int parameterIndex, String x) throws SQLException {

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementRequest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementRequest.java?rev=935868&r1=935867&r2=935868&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementRequest.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetStatementRequest.java Tue Apr 20 10:56:16 2010
@@ -20,6 +20,9 @@
 */
 package org.apache.derby.client.net;
 
+import java.sql.Date;
+import java.sql.Time;
+import java.sql.Timestamp;
 import org.apache.derby.iapi.reference.DRDAConstants;
 import org.apache.derby.client.am.Lob;
 import org.apache.derby.client.am.Blob;
@@ -31,6 +34,7 @@ import org.apache.derby.client.am.Sectio
 import org.apache.derby.client.am.SqlException;
 import org.apache.derby.client.am.Types;
 import org.apache.derby.client.am.ClientMessageId;
+import org.apache.derby.client.am.DateTimeValue;
 import org.apache.derby.client.am.Utils;
 import org.apache.derby.shared.common.reference.SQLState;
 
@@ -735,13 +739,37 @@ public class NetStatementRequest extends
                                 protocolTypesAndLengths[i][1] & 0xff); // described scale, not actual
                         break;
                     case DRDAConstants.DRDA_TYPE_NDATE:
-                        writeDate((java.sql.Date) inputs[i]);
+                        // The value may be a Date if it comes from one of the
+                        // methods that don't specify the calendar, or a
+                        // DateTimeValue if it comes from a method that does
+                        // specify the calendar. Convert to DateTimeValue if
+                        // needed.
+                        DateTimeValue dateVal = (inputs[i] instanceof Date) ?
+                                    new DateTimeValue((Date) inputs[i]) :
+                                    (DateTimeValue) inputs[i];
+                        writeDate(dateVal);
                         break;
                     case DRDAConstants.DRDA_TYPE_NTIME:
-                        writeTime((java.sql.Time) inputs[i]);
+                        // The value may be a Time if it comes from one of the
+                        // methods that don't specify the calendar, or a
+                        // DateTimeValue if it comes from a method that does
+                        // specify the calendar. Convert to DateTimeValue if
+                        // needed.
+                        DateTimeValue timeVal = (inputs[i] instanceof Time) ?
+                                    new DateTimeValue((Time) inputs[i]) :
+                                    (DateTimeValue) inputs[i];
+                        writeTime(timeVal);
                         break;
                     case DRDAConstants.DRDA_TYPE_NTIMESTAMP:
-                        writeTimestamp((java.sql.Timestamp) inputs[i]);
+                        // The value may be a Timestamp if it comes from one of
+                        // the methods that don't specify the calendar, or a
+                        // DateTimeValue if it comes from a method that does
+                        // specify the calendar. Convert to DateTimeValue if
+                        // needed.
+                        DateTimeValue tsVal = (inputs[i] instanceof Timestamp) ?
+                                    new DateTimeValue((Timestamp) inputs[i]) :
+                                    (DateTimeValue) inputs[i];
+                        writeTimestamp(tsVal);
                         break;
                     case DRDAConstants.DRDA_TYPE_NINTEGER8:
                         writeLongFdocaData(((Long) inputs[i]).longValue());

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java?rev=935868&r1=935867&r2=935868&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/Request.java Tue Apr 20 10:56:16 2010
@@ -32,6 +32,7 @@ import java.io.ObjectOutputStream;
 import java.io.UnsupportedEncodingException;
 
 import java.io.IOException;
+import org.apache.derby.client.am.DateTimeValue;
 
 public class Request {
 
@@ -1528,7 +1529,7 @@ public class Request {
         offset_ += length;
     }
 
-    final void writeDate(java.sql.Date date) throws SqlException {
+    final void writeDate(DateTimeValue date) throws SqlException {
         try
         {
             ensureLength(offset_ + 10);
@@ -1541,7 +1542,7 @@ public class Request {
         }
     }
 
-    final void writeTime(java.sql.Time time) throws SqlException {
+    final void writeTime(DateTimeValue time) throws SqlException {
         try{
             ensureLength(offset_ + 8);
             org.apache.derby.client.am.DateTime.timeToTimeBytes(bytes_, offset_, time);
@@ -1553,7 +1554,7 @@ public class Request {
       }
     }
 
-    final void writeTimestamp(java.sql.Timestamp timestamp) throws SqlException {
+    final void writeTimestamp(DateTimeValue timestamp) throws SqlException {
         try{
             boolean supportsTimestampNanoseconds = netAgent_.netConnection_.serverSupportsTimestampNanoseconds();
             int length = DateTime.getTimestampLength( supportsTimestampNanoseconds );