Re: ResultSet.getTimestamp() truncating trailing zeros in milliseconds



On Jul 7, 10:19 am, cembry <cem...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
ResultSet.getTimestamp() seems to be truncating trailing zeros in the
milliseconds field.

I have a timestamp value in the database that shows as 2008-07-07
11:23:17.220 when I query it directly using MSSQL Management Studio. Note
that the milliseconds is 220. When I query that same column using JDBC and
then do ResultSet.getTimestamp(), it is showing the value as 2008-07-07
11:23:17.22. Note that the milliseconds is 22. This only occurs when the
milliseconds field in the database is divisible by ten and so ends with a
trailing zero. I can reproduce this 100% consistently.

This looks like a bug to me. It is causing one of my unit tests to fail. Am
I doing something wrong?

SQLServer doesn't actually support datetime values with a millisecond
accuracy,
so whatever round values to a reliable accuracy no better than what
the DBMS
supports, is better, IMHO.
Joe Weinstein
.



Relevant Pages

  • Timing Question
    ... to check the database on hourly bases to see if they are any information ... other wise sql wouldnot return any thing) so even seconds should be ... milliseconds to wait to next hour..but i always get a wrong hour..for ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Corrupt Message Store! Help!
    ... > database and recieved an error saying an invalid checksum. ... > 1001748 bad checksums ... > 3151 milliseconds per read ... > appears the file headers in the db are corrupt... ...
    (microsoft.public.exchange2000.connectivity)
  • Re: Corrupt Message Store! Help!
    ... > database and recieved an error saying an invalid checksum. ... > 1001748 bad checksums ... > 3151 milliseconds per read ... > appears the file headers in the db are corrupt... ...
    (microsoft.public.exchange2000.admin)
  • Re: Corrupt Message Store! Help!
    ... > database and recieved an error saying an invalid checksum. ... > 1001748 bad checksums ... > 3151 milliseconds per read ... > appears the file headers in the db are corrupt... ...
    (microsoft.public.exchange2000.information.store)
  • Re: Corrupt Message Store! Help!
    ... > database and recieved an error saying an invalid checksum. ... > 1001748 bad checksums ... > 3151 milliseconds per read ... > appears the file headers in the db are corrupt... ...
    (microsoft.public.exchange2000.general)

Loading