1. <legend id='1aujg'><style id='1aujg'><dir id='1aujg'><q id='1aujg'></q></dir></style></legend>
        <bdo id='1aujg'></bdo><ul id='1aujg'></ul>

        <small id='1aujg'></small><noframes id='1aujg'>

        <tfoot id='1aujg'></tfoot>
      1. <i id='1aujg'><tr id='1aujg'><dt id='1aujg'><q id='1aujg'><span id='1aujg'><b id='1aujg'><form id='1aujg'><ins id='1aujg'></ins><ul id='1aujg'></ul><sub id='1aujg'></sub></form><legend id='1aujg'></legend><bdo id='1aujg'><pre id='1aujg'><center id='1aujg'></center></pre></bdo></b><th id='1aujg'></th></span></q></dt></tr></i><div id='1aujg'><tfoot id='1aujg'></tfoot><dl id='1aujg'><fieldset id='1aujg'></fieldset></dl></div>

      2. PHP PDO_mssql SQLSTATE[01002] Adaptive Server 连接失败(严重

        时间:2023-10-05
          <bdo id='o7ALw'></bdo><ul id='o7ALw'></ul>
          <i id='o7ALw'><tr id='o7ALw'><dt id='o7ALw'><q id='o7ALw'><span id='o7ALw'><b id='o7ALw'><form id='o7ALw'><ins id='o7ALw'></ins><ul id='o7ALw'></ul><sub id='o7ALw'></sub></form><legend id='o7ALw'></legend><bdo id='o7ALw'><pre id='o7ALw'><center id='o7ALw'></center></pre></bdo></b><th id='o7ALw'></th></span></q></dt></tr></i><div id='o7ALw'><tfoot id='o7ALw'></tfoot><dl id='o7ALw'><fieldset id='o7ALw'></fieldset></dl></div>

          1. <small id='o7ALw'></small><noframes id='o7ALw'>

            <tfoot id='o7ALw'></tfoot>

                  <tbody id='o7ALw'></tbody>

                • <legend id='o7ALw'><style id='o7ALw'><dir id='o7ALw'><q id='o7ALw'></q></dir></style></legend>
                  本文介绍了PHP PDO_mssql SQLSTATE[01002] Adaptive Server 连接失败(严重性 9)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在连接到外部 MSSQL 数据库以从 PHP55/osx 导出,但遇到了奇怪的问题.

                  I'm connecting to external MSSQL database for exports from PHP55/osx and I have wierd issue.

                  代码:

                  new PDO("dblib:host={$hostname};dbname={$dbname}", $user, $pass);
                  

                  抛出:

                  SQLSTATE[01002] Adaptive Server connection failed (severity 9)
                  

                  但来自 CLI 的连接工作正常

                  but connection from CLI works correcty

                  tsql -S 主机名 -U 用户 -P pass -L 数据库名:

                  locale is "cs_CZ.UTF-8"
                  locale charset is "UTF-8"
                  using default charset "UTF-8"
                  1> 
                  

                  freetds.conf:

                  [hostname]
                      host = ipaddress
                      port = 1433
                      tds version = 8.0
                  

                  tsql -C:

                                          Version: freetds v0.91
                           freetds.conf directory: /usr/local/Cellar/freetds/0.91/etc
                   MS db-lib source compatibility: no
                      Sybase binary compatibility: no
                                    Thread safety: yes
                                    iconv library: yes
                                      TDS version: 7.1
                                            iODBC: no
                                         unixodbc: no
                            SSPI "trusted" logins: no
                                         Kerberos: no
                  

                  有什么想法吗?我几乎尝试过任何东西,连接到主机名、IP、带和不带端口、实例名称、另一个用户、TDS 版本 7.0、7.1、7.2、8.0,重新安装 php 和 freetds

                  Any ideas? I have tried alomost anything, connect to hostname, ip, with and without port, to instance name, another user, TDS versions 7.0,7.1,7.2,8.0, reinstall php and freetds

                  推荐答案

                  检查这些:

                  1. 在您的磁盘上找到 freetds.conf.它可能存在于多个地方,tsql 使用一个,而 PHP 使用另一个.最好的方法是将它们符号链接到一个公共文件中并对其进行测试.请注意,该文件的常见位置是/etc/或/usr/local/etc/旁边的 ~/.freetds.conf

                  1. locate freetds.conf on your disk. It is possible it exists in several places and tsql uses one while PHP used another one. Best is to symlink them into one common file and test on that. Note that a common place for that file is ~/.freetds.conf beside /etc/ or /usr/local/etc/

                  在您的 freetds.conf 文件中应该有一个 [global] 部分.把这些行放在那里:

                  there should be a [global] section on your freetds.conf file. Put there these lines :

                  tds 版本 = 8.0

                  tds version = 8.0

                  文字大小 = 20971520

                  text size = 20971520

                  客户端字符集 = UTF-8

                  client charset = UTF-8

                  当然,我希望您已经使用 phpinfo() 检查过 PHP 加载了哪个驱动程序:mssql、sqlsrv 或 dblib

                  Of course, I expect that you already checked which driver is loaded by PHP with phpinfo(): mssql, sqlsrv or dblib

                  这篇关于PHP PDO_mssql SQLSTATE[01002] Adaptive Server 连接失败(严重性 9)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:PDO fetchAll() 主键作为数组组键 下一篇:PHP - PDO 引用是否安全从 SQL 注入?

                  相关文章

                  最新文章

                    <bdo id='HE1EZ'></bdo><ul id='HE1EZ'></ul>
                • <legend id='HE1EZ'><style id='HE1EZ'><dir id='HE1EZ'><q id='HE1EZ'></q></dir></style></legend>

                      <i id='HE1EZ'><tr id='HE1EZ'><dt id='HE1EZ'><q id='HE1EZ'><span id='HE1EZ'><b id='HE1EZ'><form id='HE1EZ'><ins id='HE1EZ'></ins><ul id='HE1EZ'></ul><sub id='HE1EZ'></sub></form><legend id='HE1EZ'></legend><bdo id='HE1EZ'><pre id='HE1EZ'><center id='HE1EZ'></center></pre></bdo></b><th id='HE1EZ'></th></span></q></dt></tr></i><div id='HE1EZ'><tfoot id='HE1EZ'></tfoot><dl id='HE1EZ'><fieldset id='HE1EZ'></fieldset></dl></div>
                    1. <small id='HE1EZ'></small><noframes id='HE1EZ'>

                      <tfoot id='HE1EZ'></tfoot>