fix: MSSQL login fails with "Unable to determine initial language" (#661)#663
Merged
fix: MSSQL login fails with "Unable to determine initial language" (#661)#663
Conversation
) Root cause: C bridge header had wrong FreeTDS constant values. DBSETCHARSET was 7 (actually DBSETNATLANG), DBSETCHARSET is 10. So "UTF-8" was being sent as the language, and no charset was set. Fix: correct all dbsetlname constants to match FreeTDS master/include/sybdb.h, add DBSETNATLANG=7 with "us_english" to the login packet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix MSSQL connection failing with "Login failed for user 'sa'" when SQL Server requires language in the TDS login packet (common with Docker images).
Closes #661
Root Cause
The C bridge header (
CFreeTDS/include/sybdb.h) had wrong constant values fordbsetlname():DBSETCHARSETDBSETNATLANGSo
dbsetlname(login, "UTF-8", 7)was actually setting the language to "UTF-8" (not charset), causing SQL Server error state 17: "Unable to determine the initial language and date format."Fix
sybdb.hto match FreeTDSmaster/include/sybdb.hDBSETNATLANG=7with"us_english"to the login packetDBSETCHARSET=10now correctly sets UTF-8 charsetTest plan