Remote ODBC Connection to IBMi Db2/iAccess Very Slow to Fetch Results

From: Date: Tue, 12 Mar 2024 12:36:15 +0000
Subject: Remote ODBC Connection to IBMi Db2/iAccess Very Slow to Fetch Results
Groups: php.db 
Request: Send a blank email to [email protected] to get a copy of this message
Hello,

At work, we have an IBM Db2 database. Until recently, it lived within our local network,
but has since been moved off-site (to the cloud). We connect to it using an iSeries Access
ODBC driver. For communication, I typically use PHP's ODBC interface (sometimes other
languages).

When the database was local, everything seemed to run smoothly; but now that it is off-site,
fetching results from SELECT queries is very slow (12 seconds for 100 rows).. I thought at first
it was an issue on our host's side (or even our network), but all tests indicated otherwise. A
proof of this is that I made a C program to run the same query (using the same driver), and it
fetched the results within milliseconds after the query completed.

I should perhaps point out that running the queries is fast, it's only fetching the result rows
that is slow.

The only comments I could find that mentioned a similar issue was for people that were using
a Db2 driver: if they passed the "SQL_CUR_USE_ODBC" option to the "odbc_connect"
function,
then their result collection was sped up. I tried that, but it made no difference (perhaps because
I'm not using a Db2 driver, per se, but an iAccess driver).

I'm not so sure that this is an error with PHP so much as a setting that needs to be tweaked;
but I can't seem to find what setting that might be. I can see there is a default_cursortype
option
in the php.ini file, but I don't know what options are available or how to properly set the
value.

I also tried using PDO and ADOdb, but both resulted in the same slowness (I'm guessing because
they just wrap the ODBC interface).

So, as I my first choice is not to re-write a bunch of scripts into C, I was wondering if any of you
might
know (or have ideas as to) what the issue might be.

The PHP versions I have been using are 8.3.2 and 8.3.3, and I've tried the test on both Windows
and
Linux.

Thanks,

Zachary


Thread (1 message)

  • Zachary Menzies
« previous php.db (#49220) next »