title: Could not do an indexed read to get the next row
body: <p>I have this connection class, where I connect with several databases.
  I need to adapt so that the Informix database performs a read-only query. Ignoring whether the table is lock.</p>
  
  <p>The message returned with the lock table is this:</p>
  
  <blockquote>
    <p>Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error:
    -246 [Informix][Informix ODBC Driver][Informix]Could not do an indexed read to get the next row. sqlerrm(retrieve row by rowid)</p>
  </blockquote>
  
  <p>In this excerpt I set the parameter <code>set isolation to dirty read;</code> but it didn't work.</p>
  
  <pre><code>$conn = new PDO("informix:host={$host}; service={$port}; database={$name}; server={$server}; protocol=onsoctcp; set isolation to dirty read;EnableScrollableCursors=1", $user, $pass);
  </code></pre>
  
  <p>Below the whole class:</p>
  
  <pre><code>&lt;?php
  
  class connection {
  
      public static $conn;
      private static $last;
  
      public static function open($basename) {
          if (file_exists("config/{$basename}.ini")) {
              $db = parse_ini_file("config/{$basename}.ini");
          } else {
              throw new exception("Error connect '$basename'");
          }
  
          $user = isset($db['user']) ? $db['user'] : NULL;
          $pass = isset($db['pass']) ? $db['pass'] : NULL;
          $name = isset($db['name']) ? $db['name'] : NULL;
          $host = isset($db['host']) ? $db['host'] : NULL;
          $type = isset($db['type']) ? $db['type'] : NULL;
          $port = isset($db['port']) ? $db['port'] : NULL;
  
  
          switch ($type) {
              case 'pgsql':
                  $port = $port ? $port : '5432';
                  $conn = new PDO("pgsql:dbname={$name}; user={$user}; password={$pass};host=$host;port={$port};");
                  break;
              case 'mysql':
                  $port = $port ? $port : '3306';
                  $conn = new PDO("mysql:host={$host};port={$port};dbname={$name}", $user, $pass);
                  break;
              case 'sqlite':
                  $conn = new PDO("sqlite:{$name}");
                  break;
              case 'ibase':
                  $conn = new PDO("firebird:dbname={$name}", $user, $pass);
                  break;
              case 'oci8':
                  $conn = new PDO("oci:dbname={$name}", $user, $pass);
                  break;
              case 'mssql':
                  $conn = new PDO("mssql:host={$host},1433;dbname={$name}", $user, $pass);
                  break;
  
              case 'informix':
                  $port = $port ? $port : '1528';
                  $server = 'ol_standard';
                  $conn = new PDO("informix:host={$host}; service={$port}; database={$name}; server={$server}; protocol=onsoctcp; set isolation to dirty read;EnableScrollableCursors=1", $user, $pass);
                  break;
          }
  
          $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  
          self::$conn[$basename] = $conn;
          self::$last = $basename;
  
      }
  
      public static function select($sql, $base = null) {
  
          if (!$base)
              $base = self::$last;
  
          return self::$conn[$base]-&gt;query($sql);
  
      }
  
      public static function exec($sql, $ret_id = false, $base = null) {
  
          if (!$base)
              $base = self::$last;
  
          $retorno = self::$conn[$base]-&gt;exec($sql);
          if ($ret_id)
              $retorno = self::$conn[$base]-&gt;lastInsertId();
          return $retorno;
  
      }
  
      public static function close($base = null) {
  
          if (!$base)
              $base = self::$last;
  
          self::$conn[$base] = null;
  
      }
  
  }
  </code></pre>