pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

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

      <bdo id='qIbek'></bdo><ul id='qIbek'></ul>
    <legend id='qIbek'><style id='qIbek'><dir id='qIbek'><q id='qIbek'></q></dir></style></legend>
      1. <i id='qIbek'><tr id='qIbek'><dt id='qIbek'><q id='qIbek'><span id='qIbek'><b id='qIbek'><form id='qIbek'><ins id='qIbek'></ins><ul id='qIbek'></ul><sub id='qIbek'></sub></form><legend id='qIbek'></legend><bdo id='qIbek'><pre id='qIbek'><center id='qIbek'></center></pre></bdo></b><th id='qIbek'></th></span></q></dt></tr></i><div class="m8jbtzf" id='qIbek'><tfoot id='qIbek'></tfoot><dl id='qIbek'><fieldset id='qIbek'></fieldset></dl></div>

        <tfoot id='qIbek'></tfoot>

        PDO 返回錯誤“找不到驅動程序"使用已知的

        PDO returning error quot;could not find driverquot; with a known working DSN(PDO 返回錯誤“找不到驅動程序使用已知的 DSN)

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

              <tfoot id='jM2Fi'></tfoot>
              <legend id='jM2Fi'><style id='jM2Fi'><dir id='jM2Fi'><q id='jM2Fi'></q></dir></style></legend>
              • <i id='jM2Fi'><tr id='jM2Fi'><dt id='jM2Fi'><q id='jM2Fi'><span id='jM2Fi'><b id='jM2Fi'><form id='jM2Fi'><ins id='jM2Fi'></ins><ul id='jM2Fi'></ul><sub id='jM2Fi'></sub></form><legend id='jM2Fi'></legend><bdo id='jM2Fi'><pre id='jM2Fi'><center id='jM2Fi'></center></pre></bdo></b><th id='jM2Fi'></th></span></q></dt></tr></i><div class="atiwojt" id='jM2Fi'><tfoot id='jM2Fi'></tfoot><dl id='jM2Fi'><fieldset id='jM2Fi'></fieldset></dl></div>
                  <bdo id='jM2Fi'></bdo><ul id='jM2Fi'></ul>
                    <tbody id='jM2Fi'></tbody>
                  本文介紹了PDO 返回錯誤“找不到驅動程序"使用已知的 DSN的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試通過 php 的 PDO 類連接到 odbc 數據庫:

                  $dsn = 'odbc:CS_HDZipCodes32bit';$用戶名 = '演示';$password = 'skdemo!';$connection = new PDO($dsn, $username, $password);死( var_dump( $connection ) );

                  但是當我這樣做時,我收到錯誤:

                  <塊引用>

                  致命錯誤:在 C:inetpubwwwrootpdoClass.php:7 堆棧跟蹤:#0 C:inetpubwwwrootpdoClass.php(7) 中出現消息找不到驅動程序"的未捕獲異常PDOException": PDO->__construct('odbc:CS_HDZipCo...', 'demo', 'skdemo!') #1 {main} 在第 7 行的 C:inetpubwwwrootpdoClass.php 中拋出

                  $dsn 值是我在 ODBC 管理器中創建的 DSN 的名稱.

                  我知道這個特定的 DSN 有效,因為我能夠構建另一個演示文件并通過 odbc_connect 成功連接:

                  $connection = odbc_connect("CS_HDZipCodes32bit", 'demo', 'skdemo!');如果(!$連接){die('連接失敗');}$statement = "SELECT * FROM ZipCodes";$result = odbc_exec($connection, $statement);//按預期輸出拉鏈var_dump(odbc_result_all($result));

                  我一直在研究

                  看起來驅動程序已安裝,除非這是不同的驅動程序.

                  另一個更新

                  根據 Marc B 的附加評論進一步檢查我的 phpini,看起來我沒有安裝 POD ODBC 特定驅動程序:

                  這里,如果我安裝了 pdo 的 ODBC 驅動程序,odbc 將位于列表的末尾,對嗎?

                  解決方案

                  在最初問題的評論中得到 Marc B 的大力幫助后,結果證明問題出在我對啟用 odbc 的誤解在我的 Web 服務器上并安裝了 pdo_odbc 驅動程序.

                  雖然我確實在 Web 服務器上啟用了 odbc,但我沒有為 PDO 安裝 odbc 驅動程序.

                  此驅動程序是通過 pdo 訪問 odbc 數據庫所必需的.

                  根據關于

                  添加驅動程序并重新啟動服務器后,我現在加載了驅動程序:

                  并且我在演示數據庫上使用 PDO 的測試查詢有效:

                  $dsn = 'odbc:CS_HDZipCodes32bit';$用戶名 = '演示';$password = 'skdemo!';$connection = new PDO($dsn, $username, $password);$query = "從郵政編碼中選擇 *";$result = $connection->query($query);foreach($result 作為 $row){var_dump($row);}

                  轉儲:

                  感謝馬克 B 的幫助.

                  I'm trying to connect to an odbc database via php's PDO class:

                  $dsn = 'odbc:CS_HDZipCodes32bit';
                  $username = 'demo';
                  $password = 'skdemo!';
                  
                  $connection = new PDO($dsn, $username, $password);
                  
                  die( var_dump( $connection ) );
                  

                  but when I do, I get the error :

                  Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in C:inetpubwwwrootpdoClass.php:7 Stack trace: #0 C:inetpubwwwrootpdoClass.php(7): PDO->__construct('odbc:CS_HDZipCo...', 'demo', 'skdemo!') #1 {main} thrown in C:inetpubwwwrootpdoClass.php on line 7

                  The $dsn value is the name of the DSN I created in my ODBC Manager.

                  I know this particular DSN works because I was able to build another demo file and connect successfully via odbc_connect:

                  $connection = odbc_connect("CS_HDZipCodes32bit", 'demo', 'skdemo!');
                  
                  if(!$connection){
                      die('connection failed');
                  }
                  
                  $statement = "SELECT * FROM ZipCodes";
                  
                  $result = odbc_exec($connection, $statement);
                  
                  
                  // Outputs the zips as expected
                  var_dump(odbc_result_all($result));
                  

                  I've been digging through the PDO-ODBC documentation as well as other resources online, but I can't figure out why PHP is unable to find the driver when trying from PDO.

                  Any ideas?

                  Update

                  I popped open my phpinfo page to make sure the odbc driver is installed per Marc B's comment:

                  It looks like the driver is installed unless this is a different driver.

                  Another Update

                  On further inspection of my phpini per Marc B's additional comment, it looks like I don't have the POD ODBC specific driver installed:

                  So here, if I had the ODBC driver for pdo installed, odbc would be at the end of the list, correct?

                  解決方案

                  After getting some great help from Marc B in the initial question's comments it turns out the problem was coming from my misunderstanding of enabling odbc on my web server and having the pdo_odbc driver installed.

                  While I did have odbc enabled on the web server, I did not have the odbc driver installed for PDO.

                  This driver is necessary to be able to access odbc databases via pdo.

                  Per the php.net documentation on installing pdo for windows, the driver was already included in the php build (I'm using version 5.5) and just needed to be included in the php.ini file.

                  After adding the driver and restarting the server I now had the driver loaded:

                  and my test query using PDO on my demo database worked:

                  $dsn = 'odbc:CS_HDZipCodes32bit';
                  $username = 'demo';
                  $password = 'skdemo!';
                  
                  $connection = new PDO($dsn, $username, $password);
                  
                  $query = "Select * FROM ZipCodes";
                  
                  
                  $result = $connection->query($query);
                  
                  foreach($result as $row){
                      var_dump($row);
                  }
                  

                  Dumps out:

                  Thanks for your help Marc B.

                  這篇關于PDO 返回錯誤“找不到驅動程序"使用已知的 DSN的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  MySQLi prepared statement amp; foreach loop(MySQLi準備好的語句amp;foreach 循環)
                  Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務器還是從同一用戶獲取記錄?)
                  PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                  mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數)
                  Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結果填充變量)
                  MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“localhost的訪問被拒絕)

                  <tfoot id='AEzhT'></tfoot>
                • <small id='AEzhT'></small><noframes id='AEzhT'>

                      <tbody id='AEzhT'></tbody>
                  • <i id='AEzhT'><tr id='AEzhT'><dt id='AEzhT'><q id='AEzhT'><span id='AEzhT'><b id='AEzhT'><form id='AEzhT'><ins id='AEzhT'></ins><ul id='AEzhT'></ul><sub id='AEzhT'></sub></form><legend id='AEzhT'></legend><bdo id='AEzhT'><pre id='AEzhT'><center id='AEzhT'></center></pre></bdo></b><th id='AEzhT'></th></span></q></dt></tr></i><div class="yrg58z0" id='AEzhT'><tfoot id='AEzhT'></tfoot><dl id='AEzhT'><fieldset id='AEzhT'></fieldset></dl></div>
                    • <legend id='AEzhT'><style id='AEzhT'><dir id='AEzhT'><q id='AEzhT'></q></dir></style></legend>

                          <bdo id='AEzhT'></bdo><ul id='AEzhT'></ul>

                            主站蜘蛛池模板: 安平县鑫川金属丝网制品有限公司,防风抑尘网,单峰防风抑尘,不锈钢防风抑尘网,铝板防风抑尘网,镀铝锌防风抑尘网 | PC构件-PC预制构件-构件设计-建筑预制构件-PC构件厂-锦萧新材料科技(浙江)股份有限公司 | 电动打包机_气动打包机_钢带捆扎机_废纸打包机_手动捆扎机 | 红外光谱仪维修_二手红外光谱仪_红外压片机_红外附件-天津博精仪器 | 防水套管-柔性防水套管-刚性防水套管-上海执品管件有限公司 | 色谱柱-淋洗液罐-巴罗克试剂槽-巴氏吸管-5ml样品瓶-SBS液氮冻存管-上海希言科学仪器有限公司 | 涿州网站建设_网站设计_网站制作_做网站_固安良言多米网络公司 | 送料机_高速冲床送料机_NC伺服滚轮送料机厂家-东莞市久谐自动化设备有限公司 | 不锈钢散热器,冷却翅片管散热器厂家-无锡市烨晟化工装备科技有限公司 | 桐城新闻网—桐城市融媒体中心主办 | 烟气换热器_GGH烟气换热器_空气预热器_高温气气换热器-青岛康景辉 | 武汉EPS线条_EPS装饰线条_EPS构件_湖北博欧EPS线条厂家 | 复盛空压机配件-空气压缩机-复盛空压机(华北)总代理 | 四川实木门_成都实木门 - 蓬溪聚成门业有限公司 | 智能家居全屋智能系统多少钱一套-小米全套价格、装修方案 | 不锈钢闸阀_球阀_蝶阀_止回阀_调节阀_截止阀-可拉伐阀门(上海)有限公司 | 胜为光纤光缆_光纤跳线_单模尾纤_光纤收发器_ODF光纤配线架厂家直销_北京睿创胜为科技有限公司 - 北京睿创胜为科技有限公司 | RO反渗透设备_厂家_价格_河南郑州江宇环保科技有限公司 | 传动滚筒_厂家-淄博海恒机械制造厂| 集装箱展厅-住人集装箱住宿|建筑|房屋|集装箱售楼处-山东锐嘉科技工程有限公司 | 耐驰泵阀管件制造-耐驰泵阀科技(天津)有限公司 | 天津中都白癜风医院_天津白癜风医院_天津治疗白癜风 | 天然鹅卵石滤料厂家-锰砂滤料-石英砂滤料-巩义东枫净水 | 诚暄电子公司首页-线路板打样,pcb线路板打样加工制作厂家 | 电力测功机,电涡流测功机,磁粉制动器,南通远辰曳引机测试台 | 铸钢件厂家-铸钢齿轮-减速机厂家-淄博凯振机械有限公司 | 广西绿桂涂料--承接隔热涂料、隔音涂料、真石漆、多彩仿石漆等涂料工程双包施工 | 哈希余氯测定仪,分光光度计,ph在线监测仪,浊度测定仪,试剂-上海京灿精密机械有限公司 | 【直乐】河北石家庄脊柱侧弯医院_治疗椎间盘突出哪家医院好_骨科脊柱外科专业医院_治疗抽动症/关节病骨伤权威医院|排行-直乐矫形中医医院 | 河北凯普威医疗器材有限公司,高档轮椅系列,推车系列,座厕椅系列,协步椅系列,拐扙系列,卫浴系列 | 分子精馏/精馏设备生产厂家-分子蒸馏工艺实验-新诺舜尧(天津)化工设备有限公司 | 铸铝门厂家,别墅大门庭院大门,别墅铸铝门铜门[十大品牌厂家]军强门业 | 浙江富广阀门有限公司 | 数显水浴恒温振荡器-分液漏斗萃取振荡器-常州市凯航仪器有限公司 | 自动气象站_农业气象站_超声波气象站_防爆气象站-山东万象环境科技有限公司 | 金环宇|金环宇电线|金环宇电缆|金环宇电线电缆|深圳市金环宇电线电缆有限公司|金环宇电缆集团 | 聚合氯化铝_喷雾聚氯化铝_聚合氯化铝铁厂家_郑州亿升化工有限公司 | FFU_空气初效|中效|高效过滤器_空调过滤网-广州梓净净化设备有限公司 | 有福网(yofus.com)洗照片冲印,毕业聚会纪念册相册制作个性DIY平台 | 蔡司三坐标-影像测量机-3D扫描仪-蔡司显微镜-扫描电镜-工业CT-ZEISS授权代理商三本工业测量 | 压滤机-洗沙泥浆处理-压泥机-山东创新华一环境工程有限公司 |