Apply timezone to Timestamp when using bulkcopy for batch insert#2291
Apply timezone to Timestamp when using bulkcopy for batch insert#2291
Conversation
c79b068 to
0861bc5
Compare
|
Hi @tkyc I appreciate you making the changes. I observed that the fix had the following problems:
May I ask if the changes need to be done at SQLServerBulkCopy ? |
|
@PriyadharshiniP Thanks for the feedback. I'll do more investigating and I'll look into correcting the implementation.
That was my initial thought also, but when I looked over SQLServerBulkCopy it doesn't look like I'm able to apply the timezone in the TDS request for bulkcopy. For example, I sort of expected code like this in SQLServerBulkCopy, which is part of the normal and regular batch insert code path. The code below takes into consideration the the timezone by sending the timezone info in the TDS request. So the timezone is applied during insertion by the server: But I'm guessing because we're doing a bulkcopy, it has to send the timestamp value as is. And so, either the user or driver needs to apply the timezone conversion beforehand. |
Thanks for fixing the issue.
This time "GMT: Sunday, October 1, 2023 2:30:00 AM" doesn't exist in my local time zone. The non bulk version correctly inserts the date as
Could you see if we can accomplish something along these lines? |
|
@PriyadharshiniP Thanks for collaborating.
Yeah, I struggled with getting that working as well when I initially looked at the code. In In the above call path, I expected to end up somewhere where the timestamp value is written to the TDS request (something/somewhere where the logic
Thanks for the help on testing. I'll see what I can do here... |
|
@PriyadharshiniP What's your exact local time zone? I've switched my PC's time zone setting to various different time zones that doesn't have day light savings and wasn't able to repro the issue with Maybe I need to do something like below explicitly to repro your issue? |
|
My local timezone is Australia/Sydney
…On Wed, 17 Jan 2024, 8:11 am Terry Chow, ***@***.***> wrote:
@PriyadharshiniP <https://github.com/PriyadharshiniP> What's your exact
local time zone? I've switched my PC's time zone setting to various
different time zones that doesn't have day light savings and wasn't able to
repro the issue. I double checked the local time zone used in my JDK and it
matches my PC time zone.
—
Reply to this email directly, view it on GitHub
<#2291 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABXI4WXKWWK5KQJQM6BSDXLYO3UHDAVCNFSM6AAAAABBVM2HUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJUGUYTQOBUGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I guess you could do something like this in your unit test : |
|
@PriyadharshiniP I've just pushed a new fix implementation. I did some testing of it and it seem to have addressed all your concerns so far. Let me know if there's any additional problems. Thanks again for the collab. |
Hi @tkyc |
3fcb1e0 to
d162dcc
Compare
|
@PriyadharshiniP Oops, my mistake. Calling valueOf will cause a conversion. Fixed. |
Thanks @tkyc : Regards |
|
@PriyadharshiniP this will make it in the release that's on the 31st of this month. |







Correctly applies the timezone to Timestamps when inserted using batch insert with bulkcopy.
Fixes #2271