Sql-docs: Default on for all clients or only the mentioned ones?

Created on 18 Mar 2020  Â·  5Comments  Â·  Source: MicrosoftDocs/sql-docs

Wenn I connect with a custom TDS client (based on jtds) @@options/sessionproperty() tells me ANSI_WARN is ON, but it's not on in master, model or target database and not in useroptions. Where is the default coming from (it is not the driver as me mentioned on this page for OLE and native).


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 assigned-to-author doc-bug sqprod t-sqtech

All 5 comments

I think I found the answer, there is a login option in the TDS stream, if that is set the client requests it: https://github.com/microsoft/mssql-jdbc/blob/75a235eeafc631e30c73b18f5a3802ee5029cc8a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java#L5002

Maybe the documentation can be changed to add "clients like native, dBlib.
.. who set the ODBC_ANSI_ON connection flag get ANSI_DEFAULTS On..."?

https://github.com/seeburger-ag/jTDS/blob/jTDS_1.3_(stable)-seeburger/src/main/net/sourceforge/jtds/jdbc/TdsCore.java#L2044

@ecki -- Bernd, thank you for your question and followup.

@CarlRabeler -- Carl, please look into this issue #4363.

Maybe just an explanation why I care: I was verifying if the ANSI settings are always as expected, I was looking for a way an administrator could configure the server in a way that the options are not present. Knowing that they are enforced by clients is good, but since my (JDBC) Client is not in the list I wanted to check how the clients actually enforce it. I would provide a PR but I am not clear on the terminology:

The [!INCLUDEssNoVersion] Native Client ODBC driver and [!INCLUDEssNoVersion] Native Client OLE DB Provider for [!INCLUDEssNoVersion] automatically set ANSI_WARNINGS to ON when connecting. This can be configured in ODBC data sources, in ODBC connection attributes, set in the application before connecting. The default for SET ANSI_WARNINGS is OFF for connections from DB-Library applications.

Maybe

Some clients (especially the [!INCLUDEssNoVersion] Native Client ODBC driver, [!INCLUDEssNoVersion] Native Client OLE DB Provider for [!INCLUDEssNoVersion], and the Microsoft JDBC Driver for [!INCLUDEssNoVersion] automatically set ANSI_WARNINGS to ON with a connection flag. This can be configured in ODBC data sources, in ODBC connection attributes, set in the application before connecting. The default for SET ANSI_WARNINGS is OFF for connections from DB-Library applications.

Not sure if you want to mention/refer to OptionFlags2 fODBC from https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/773a62b6-ee89-4c02-9e5e-344882630aac

@ecki pull request pending. Thanks for bringing this to my attention.
Carl

live within the hour - closing this issue.

Was this page helpful?
0 / 5 - 0 ratings