Menu

#73 Datetime2 support

open
nobody
None
5
2022-12-29
2010-06-10
No

SQL server 2008 adds the datatype datetime2.

jTDS currently returns these as a String from a query when they should be java.sql.Date

For insert / update jTDS seems to apply the 3ms rounding as per a datetime, which is unnecessary and unwanted for datetime2.

We have some unit tests to test datetime2 support. They need to be tidied up and have dependencies removed, but I can supply them if desired.

Discussion

1 2 > >> (Page 1 of 2)
  • Anonymous

    Anonymous - 2012-09-03

    Hi. I ran acroos the same problem of the rounding in the jTDS driver. The rounding seems to appear in DateTime#pack (Line 332).

    In my opinion it is not necassary to round the date at this point (at least for MSSQL 2008) since it will do it itself if necassary:

    select CAST('2007-05-08 12:35:29.125' AS datetime2);

    Result: 2007-05-08 12:35:29.1250000

    --

    select CAST('2007-05-08 12:35:29.125' AS datetime);

    Result: 2007-05-08 12:35:29.12

    Best Regards, Torsten

     
  • Oliver

    Oliver - 2012-09-10

    3ms rounding also being applied in v1.2.6

     
  • James

    James - 2014-09-01

    I had a quick look at implementing this but it turns out there's a lot more to it than just the revised datetime2 storage format. The two most obvious problems are:
    1. It requires supporting the TDS 7.3 protocol. The only reason datetime2 works at all at the moment is because SQL server detects the older client and converts to datetime wire format.
    2. There doesn't appear to be a clean way for the jTDS driver to know whether the native storage is datetime or datetime2. Maybe this can be resolved using a proprietary jdbc escape sequence, e.g. {dt ?} which when parsed sets the pi.scale appropriately which can be used later to differentiate the data type.

    So I think this is going to require one of the core devs to resolve, not just a nosey parker like me.

     
  • JoHa

    JoHa - 2015-01-28

    The issue remains in v1.3.1.
    Would be really great to have this resolved.

     
  • Anonymous

    Anonymous - 2016-08-31

    +1 on a request to get this issue resolved. Lack of this support has forced us to go back to using datetime on our deployment as a workaround for now.

     
  • Anonymous

    Anonymous - 2018-06-08

    +1 on request for resolution

     
  • Anonymous

    Anonymous - 2018-08-10

    +1 on request for resolution

     
  • Anonymous

    Anonymous - 2019-06-11

    +1 on request for resolution

     
  • Anonymous

    Anonymous - 2020-05-07

    +1 on request for resolution

     
  • Anonymous

    Anonymous - 2021-03-20

    +1 on request for resolution

     
  • Anonymous

    Anonymous - 2021-12-08
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2021-12-09
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2021-12-11
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2021-12-13
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2021-12-13
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2021-12-13
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2021-12-16
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2022-05-09
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2022-05-09
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2022-05-31
    Post awaiting moderation.
  • Anonymous

    Anonymous - 2022-12-16
    Post awaiting moderation.
1 2 > >> (Page 1 of 2)

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.