Adaptive Server versions 12.5.1 and later offer support for the SQL date and time datatypes. Previously, Adaptive Server offered only support for the datetime and smalldatetime datatypes. These datatypes were limited for the following reasons:
There was not a way to have separate time and date datatypes.
Dates prior to 1/1/1753 were illegal. Datetime values could hold only dates between 1/1/1753 and 12/31/9999.
When JDBC clients used the setTime and setDate methods to insert java.sql.Time or java.sql.Date methods, the values were converted to datetime datatypes in the server. This conversion resulted in the addition of a default date or time to the insert value supplied by the client.
The addition of the date and time datatypes provides the following advantages:
Date values can now be between Jan. 1, 0001 and Dec. 31, 9999, exactly matching the allowable values in java.sql.Date.
A direct mapping now exists between java.sql.Date and the date dataype, as well as between java.sql.Time and the time datatype.
The date and time datatypes can be used only with jConnect 5.5 and later. To use them, a jConnect client must set the driver version to 6. To do so, the client can use the SybDriver.setVersion() method, or use the JCONNECT_VERSION connection property.
You will not have to change any of the application code if you decide to use the date and time datatypes by setting the version to 6.
If you select from a table that contains a date or time column, and you have not enabled date/time support in jConnect (by setting the version), the server will try to convert the date or time to a datetime value before returning it. This can cause problems if the date to be returned is prior to 1/1/1753. In that case, a conversion error will occur, and the database will inform you of the error.
Adaptive Server Anywhere supports a date and time datatype, but the date and time datatypes are not yet directly compatible with those in Adaptive Server version 12.5.1 and later. Using jConnect, you should continue to use the datetime and smalldatetime datatypes when communicating with Adaptive Server Anywhere.
The maximum value in a datetime column in Adaptive Server Anywhere is 1-1-7911 00:00:00.
Using jConnect you will receive conversion errors if you attempt to insert dates prior to 1/1/1753 into datetime columns or parameters
Refer to the Adaptive Server manuals for more information on the date and time datatypes; of special note is the section on allowable implicit conversions.
If you use getObject( ) with an Adaptive Server date, time, or datetime column, the value returned will be, respectively, a java.sql.Date, java.sql.Time, or java.sql.Timestamp datatype.
Copyright © 2003. Sybase Inc. All rights reserved. |
![]() |