【问题标题】:Ignite: problems SELECTing using PHP PDO点燃:使用 PHP PDO 进行选择的问题
【发布时间】:2018-04-16 07:11:56
【问题描述】:

使用 PHP PDO 访问 Ignite 集群。

1) 使用 PHP PDO 脚本创建了一个表。

生成的缓存在 Ignite Web 控制台中可见。

可以从 Ignite Web 控制台发出 SQL SELECT/INSERT。

可以使用独立的 PHP PDO 发出 SQL INSERT。

所以 SQL 表/缓存看起来功能齐全,但是:

2) 从 PHP PDO 脚本内部选择失败。

PHP PDO 脚本与 Ignite 网站上提供的示例脚本基本相同。

<?php
try {
    $dbh=new PDO('odbc:ApacheIgniteDSN');
    $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $res=$dbh->query('SELECT id from Person');
// no errors up to here
//exit;
    if ($res == FALSE)
        print_r("Exception");

    // the following results in errors
    foreach($res as $row) {
        print_r($row);
    }
}
catch (PDOException $e) {
    print "Error: " . $e->getMessage() . "\n";
    exit;
}*

从命令行运行时,会生成:

错误:SQLSTATE[HYC00]:未实现可选功能:0 指定 不支持属性。 (SQLFetchScroll[0] 在 分机\pdo_odbc\odbc_stmt.c:543)

这不是很有帮助,但在 Ignite 节点上会记录以下内容:

[17:00:30,074][SEVERE][grid-nio-worker-client-listener-0-#30][ClientListenerProcessor] Failed to process selector key [ses=GridSelectorNioSessionImpl [worker=ByteBufferNioClientWorker [readBuf=java.nio.HeapByteBuffer[pos=0 lim=8192 cap=8192], super=AbstractNioClientWorker [idx=0, bytesRcvd=0, bytesSent=0, bytesRcvd0=0, bytesSent0=0, select=true, super=GridWorker [name=grid-nio-worker-client-listener-0, igniteInstanceName=null, finished=false, hashCode=1314397987, interrupted=false, runner=grid-nio-worker-client-listener-0-#30]]], writeBuf=null, readBuf=null, inRecovery=null, outRecovery=null, super=GridNioSessionImpl [locAddr=/100.96.3.26:10805, rmtAddr=/100.96.3.1:6733, createTime=1523811628969, closeTime=0, bytesSent=69, bytesRcvd=75, bytesSent0=69, bytesRcvd0=75, sndSchedTime=1523811629031, lastSndTime=1523811629031, lastRcvTime=1523811629020, readsPaused=false, filterChain=FilterChain[filters=[GridNioAsyncNotifyFilter, GridNioCodecFilter [parser=ClientListenerBufferedParser, directMode=false]], accepted=true]]]
java.io.IOException: Connection reset by peer

请注意,我使用 CREATE TABLE 命令(来自 PHP PDO 脚本)创建了 SQL 表,而不是使用 queryEntities 在缓存中明确指定它。但是,Web 控制台可以正确看到它,并且您可以在那里对其进行查询,因此人们会假设 PDO 中的 SELECT 也可以工作,但事实并非如此。

【问题讨论】:

  • 你的 Ignite 版本是多少?
  • @isapego 2.4.0。使用 Kubernetes 部署。 image: apacheignite/ignite:2.4.0

标签: ignite


【解决方案1】:

这是一个known issue,它是由MS 游标库引起的,在某些情况下显然被PDO 使用。正如 Ignite 的 Jira 所说,它已被修复,并且补丁已合并到 master,因此您可以等待 2.5 发布,或者改用 master 分支代码。

【讨论】:

  • 我安装了几天前 (2.5.0.20180426) 的 Nightly 版本,但问题仍然完全相同。您提到的 JIRA 问题似乎修复了一个不同的 ODBC 错误。
  • @SV,这很奇怪,因为我可以在 2.4 上重现您的问题,但无法在 2.5 上重现。你确定你已经正确安装了所有东西吗?
  • 由于托管环境迁移的一些问题(与 Ignite 无关),直到现在才能重新测试。我从头开始重新安装了 Ignite 集群(使用 2.5.0 版本),以及所有 Ignite Windows 客户端库。它现在完美运行。我想我在使用 2.5 beta 之前(先安装 2.4 之后)看到了这个错误,因为 Ignite ODBC 驱动程序可能无法更新。无论如何,干得好。
猜你喜欢
  • 2015-04-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-03-18
  • 2017-07-02
  • 2014-04-14
  • 2020-07-29
  • 2012-06-12
相关资源
最近更新 更多