freeTDS not using its config

后端 未结 5 1843
执念已碎
执念已碎 2020-12-02 16:13

I\'ve decided to use FreeTDS driver and unixODBC to manage the PDO connection between my LAMP-based app with a remote MsSQL database. unfortunately it appears that the drive

5条回答
  •  臣服心动
    2020-12-02 16:53

    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.

提交回复
热议问题