Freetds Not Using Its Config

freeTDS not using its config

I spent a long time today debugging a similar problem. I had set "TDS version" in freetds.conf but it was not being used in my ODBC connection. After reading the freetds source code (connectparams.c:odbc_parse_connect_string) I discovered that:

  • If your connection string uses "SERVER=" then both freetds.conf and odbc.ini are ignored
  • If your connection string uses "SERVERNAME=" then the settings in the appropriate freetds.conf server are used
  • If your connection string uses "DSN=" then the settings in the appropriate odbc.ini DSN are used

odbcinst.ini is a red herring. FreeTDS never checks that for settings.

The settings you specify in the connection string are always respected. It also always respects the environment variables like TDSVER.

freetds not recognizing version from any config files

You're running FreeTDS v0.91 which does not support TDS version 7.4. IIRC the highest it supports is 7.2. Trying using version 7.2.

If you want to use TDS version 7.3, you'll need at least FreeTDS 0.95, and if you want 7.4, you'll need FreeTDS 1.0.

I have a PR to clarify this, but it hasn't been pushed out to the documentation.

Good luck!

tsql utility (FreeTDS) can connect to SQL Server but pymssql cannot

I find a clue and I'm quite surprised byt it... If I use a username with less than 32 characters, I have no more issue with pymssql ! I didn't find anything about this weird bug (?) but I promess it fixes my issue.

I need to see the code of pymssql and see if I find any lenght restriction or issue about the lenght of the username



Related Topics



Leave a reply



Submit