· Oct 26, 2023

ODBC Error on single table "No columns were bound prior to calling SQLFetch"

I am very new to IRIS. We are developing a PHP application that connects to an IRIS instance of one of our vendors. I am having trouble with a specific table. When I need to query this specific table for specific fields, I am receiving an error. However, if I change the call to get all columns (`*`), there is no error. I get 37K records returned.


PHP Fatal error:  Uncaught PDOException: SQLSTATE[SL009]: <<Unknown error>>: [unixODBC][Driver Manager]No columns were bound prior to calling SQLFetch or SQLFetchScroll (SQLFetchScroll[0] at /builddir/build/BUILD/php-8.1.20/ext/pdo_odbc/odbc_stmt.c:547) in test.php:187
Stack trace:
#0 IRIS.php(187): PDOStatement->fetchAll(2)
#1 test.php(20): Models\Db\AthenaIRIS::getRecords('HPA', 'FeeScheduleTxn', Array)
#2 {main}
  thrown in IRIS.php on line 187






Digging on the internet produced this StackOverflow question, but there are no answers. Is anyone else experiencing a similar problem or is there a known solution to this issue?

Discussion (4)1
Log in or sign up to continue

I am not binding the columns because I'm using PDO fetch mode `FETCH_ASSOC` to cast the resulting object to an array.

Also I should've made this more clear, the exact same functionality works for all other IRIS queries I have. For example, the following query returns results properly:

SELECT Id, Name, Mnemonic, Type FROM Dict.VisitTypes;

Are there settings or anything configurable that could effect this on specific tables?