Skip to content

Conversation

TPVallancourt
Copy link

@TPVallancourt TPVallancourt commented Oct 29, 2024

Fix for #1563

  1. Add isFabric option to ConnectionConfiguration which controls which Login7 packet is created. It appears that the packet which is required for Fabric does not work for SQLServer
  2. If isFabric, write FeatureExtensions to the end of the Login7 Packet matching the behavior of the go-mssqldb library. The header must still be written in the same place as it was previously. The value in the header is adjusted to reflect that FeatureExtensions now appear at the end of the packet
  3. When receiving routing data from the server, save a new string, instance. Previously we just saved server which removes the instance name from the redirect URL. This is the proper string for TLS negotiation, but Login7 needs the server and the instance together.
  4. On the prelogin payload, include a randomly generated traceID, Starting with TDS37.0 it seems that traceID is no longer optional for Fabric.

@TPVallancourt TPVallancourt changed the title Move FeatureExtensions to end of Login7 Packet + use full server name for Login7 fix: Move FeatureExtensions to end of Login7 Packet + use full server name for Login7 Oct 29, 2024
@TPVallancourt
Copy link
Author

Hi @arthurschreiber , are there any other things I need to do get this incorporated into the library?

@arthurschreiber arthurschreiber changed the title fix: Move FeatureExtensions to end of Login7 Packet + use full server name for Login7 fix: include instance name in Login7 message Nov 10, 2024
@arthurschreiber
Copy link
Collaborator

@TPVallancourt This seems to break the appveyor build on Windows 🤔


payload.hostname = this.config.options.workstationId || os.hostname();
payload.serverName = this.routingData ? this.routingData.server : this.config.server;
payload.serverName = this.routingData ? `${this.routingData.server}\\${this.routingData.instance}` : this.config.server;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is instance here guaranteed to always be a non-empty string? What happens if it's empty?

@TPVallancourt TPVallancourt changed the title fix: include instance name in Login7 message fix: include instance name in Login7 message and traceID in prelogin Dec 5, 2024
@kenny-statsig
Copy link

@TPVallancourt Hi, just curious if this is planned to be merged and released soon? I am currently relying on this PR for Fabric Warehouse connections

@TPVallancourt
Copy link
Author

Hi @arthurschreiber ! Finally found some time to think about this PR some more. Microsoft appears to have pushed out an update this week which has made Fabric a lot faster and more reliable, so it seemed like a good time to revisit this.

The big change since you last reviewed is that I added an isFabric flag in the options which will control which version of the Login7 payload we send. This is admittedly hacky but it does let people use the library for Fabric without breaking existing integrations. Let me know what you think!

Additionally, I think it would be good to add integration testing to a Fabric warehouse - not sure what the protocol is for setting something like that up for this repo. Any ideas?

Thank you!

connectionId: 0,
clientTimeZone: new Date().getTimezoneOffset(),
clientLcid: 0x00000409
clientLcid: 0x00000409,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is one hell of an opaque magic number…

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the MS-TDS spec, the ClientLCID value is no longer used to set language parameters and is ignored.

@iPommes
Copy link

iPommes commented Aug 14, 2025

Hey to everyone,
is there anything new to this issue?
And also is there a forecast when this fix will be merged?

Really looking forward to use the official tedious implementation to connect to Microsoft Fabric.

Thanks! (:

fixedData.writeUInt32LE(0, offset);
}

if (this.isFabric) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From just a code read, I'm trying to understand how tedious works with feature extensions before this change. It seems like the previous code is writing the feature extension data to the completely wrong place (the middle instead of the end) compared to what the spec defines. My guess is that SQL Server and Azure SQL DB endpoints are just a lot more forgiving in the name of backwards compatibility with existing clients.

Is there even any need for the isFabric logic? I would think the changes would work on both Fabric and non-Fabric endpoints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants