【问题标题】:Can't connect to Azure SQL with FreeTDS无法使用 FreeTDS 连接到 Azure SQL
【发布时间】:2016-07-16 06:51:33
【问题描述】:

我已经在网上搜索了 6 个小时,但仍然无法弄清楚这一点。如果你有一个重复的问题链接,我全神贯注,但我可能已经看过了:/

我正在尝试通过我的 LAMP 堆栈连接到我的 Azure SQL 实例,但它没有发生,我不知道为什么。

我已经用openssl编译并安装了FreeTDS,安装了php5-sybaseunixodbctdsodbcphp5-odbc

FreeTDS 名称查找工作正常,但与服务器的实际连接不工作。我收到了非常通用的 20009 Adaptive Server is unavailable 错误。

我也已将我的 IP 添加到 Azure 门户中的允许 IP 列表中。我已经尝试过 TDS 版本 7.0、7.1、7.2 和 7.3 以及带有 encryption = off|request|require 的版本的每个排列。

我已尝试连接到 freeTDS 名称、DNS 名称和直接 IP 地址。我已经尝试指定端口以及将其关闭。我已经确认没有本地防火墙。

这就是我在tsql 中看到的(对于 PHP,同样的最终错误也是如此):

locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Setting MyDatabase as default database in login packet
14> Error 20009 (severity 9):
    Unable to connect: Adaptive Server is unavailable or does not exist
There was a problem connecting to the server

这是我的freetds.conf

[BlueRavenSolar]
    host = myserver.database.windows.net
    port = 1443
    tds version = 7.3
    encryption = request

还有tsql -C的输出:

Compile-time settings (established with the "configure" script)
                        Version: freetds v0.95.89
         freetds.conf directory: /usr/local/etc
 MS db-lib source compatibility: yes
    Sybase binary compatibility: no
                  Thread safety: yes
                  iconv library: yes
                    TDS version: 5.0
                          iODBC: no
                       unixodbc: no
          SSPI "trusted" logins: no
                       Kerberos: no
                        OpenSSL: yes
                         GnuTLS: no

【问题讨论】:

    标签: php azure pdo azure-sql-database freetds


    【解决方案1】:

    您是否更改了Azure SQL的端口,因为您的freetds.conf中的端口是1443,而Azure SQL的默认端口应该是1433。那你可以尝试修改为1433再试一次吗?

    【讨论】:

      猜你喜欢
      • 2021-08-26
      • 2014-11-06
      • 2019-02-09
      • 2019-04-24
      • 2019-10-16
      • 1970-01-01
      • 1970-01-01
      • 2018-04-23
      • 2019-12-12
      相关资源
      最近更新 更多