<tfoot id='IggtJ'></tfoot>

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

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

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

        如何在 Laravel 中使用 SQL Server 连接?

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

              <small id='uOYyS'></small><noframes id='uOYyS'>

                  <tbody id='uOYyS'></tbody>
                • <legend id='uOYyS'><style id='uOYyS'><dir id='uOYyS'><q id='uOYyS'></q></dir></style></legend>
                  本文介绍了如何在 Laravel 中使用 SQL Server 连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个在 Laravel 3 中制作的工作项目,我必须切换到 MsSQL Server(虽然不是我的电话,嗅探......)而且我不了解这种数据库类型的 Laravel 配置......

                  I got a working project made in Laravel 3 that I have to switch to MsSQL Server (not my call though, sniff...) and I don't understand the Laravel configuration on this database type...

                  我将 database.php 中的默认值更改为这个 'default' =>'sqlsrv' 然后我在 sqlsrv 数组中配置了主机、数据库、用户名、密码,但随后我收到以下错误消息:

                  I changed the default inside database.php to this 'default' => 'sqlsrv' then I configured the host, database, username, password in the sqlsrv array but then I get this error message:

                  此扩展需要 Microsoft SQL Server 2012 Native Client ODBC 驱动程序才能与 SQL Server 通信`

                  This extension requires the Microsoft SQL Server 2012 Native Client ODBC Driver to communicate with SQL Server`

                  经过一些研究,我发现我们需要 SQLSRV 的 PDO,我已经拥有 5.4 版,并且在我的 phpinfo 中我得到了返回的 pdo_sqlsrv support : enabled 所以它似乎一切都正确,但同时它似乎要求 ODBC SQLSRV 连接,我真的必须使用它吗?

                  After some research I found that we need PDO of SQLSRV, which I already have as version 5.4 and in my phpinfo I get this returned pdo_sqlsrv support : enabled so it seems all correct but at the same time it seems to ask for ODBC SQLSRV connections, does I really have to use that?

                  我宁愿直接从 Laravel 数据库连接进行连接...但即使我需要它并且我创建了一些到服务器的 ODBC 连接,我如何将它们放入我的配置中?这是我的配置中的内容(当然 my... 已替换为我的真实详细信息):

                  I would rather connect directly from the Laravel database connection... but even if I need it and I created some ODBC connection to the server, how do I put them inside my configuration? Here is what I have in my configuration (of course the my... is replace by my real details) :

                  'sqlsrv' => array(
                      'driver'   => 'sqlsrv',
                      'host'     => 'myServerIP', 
                      'database' => 'myDatabase',
                      'username' => 'myUsername',
                      'password' => 'myPassword',
                      'prefix'   => '',
                   ),
                  

                  任何帮助将不胜感激,我发现唯一与我的问题接近的是 Laravel 论坛的链接:SQL Server 上的 Laravel 查询,然后它就停止了,没有给出任何配置.

                  Any help would be greatly appreciated, the only thing I found close to my problem was this link from the Laravel forum: Laravel query on SQL Server but then it just stop without giving any configurations.

                  推荐答案

                  啊,经过一番研究,我发现我的 SQL Server Native Client 10.0 的驱动程序已经过时并且不够用要使用 PDO 连接到 MsSQL Server 2008,您需要至少具有 11.0 版本才能连接到 SQL Server 2005+

                  Ahh after a lot more research, I found out that my driver of SQL Server Native Client 10.0 was out of date and not sufficient to connect to a MsSQL Server 2008 with PDO, you need to have at least version 11.0 in order to connect to an SQL Server 2005+

                  如果你想验证你的驱动版本,你可以通过控制面板>>管理工具>>数据源 (ODBC),然后单击 Drivers 选项卡以找出您已安装的 SQL Server Native Client.如果您想更新您的驱动程序,根据您的操作系统配置,您可以选择下面的正确链接...

                  If you want to validate your driver version, you can go through Control Panel >> Administrative Tools >> Data Sources (ODBC) and then click on the Drivers tab to find out which SQL Server Native Client you have already installed. If you want to update your driver, depending on your OS configuration you may choose the proper link below...

                  SQL Server 2012 本机客户端
                  x86(32 位)包 http://go.microsoft.com/fwlink/?LinkID=239647&clcid=0x409
                  x64(64 位)包 http://go.microsoft.com/fwlink/?LinkID=239648&clcid=0x409

                  这篇关于如何在 Laravel 中使用 SQL Server 连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 laravel 模型中更改数据库连接 下一篇:来自自引用表的 Laravel ORM 获取 N 级层次结构 JSON

                  相关文章

                  <small id='zHrYX'></small><noframes id='zHrYX'>

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

                        <bdo id='zHrYX'></bdo><ul id='zHrYX'></ul>
                    1. <tfoot id='zHrYX'></tfoot>

                      <legend id='zHrYX'><style id='zHrYX'><dir id='zHrYX'><q id='zHrYX'></q></dir></style></legend>