Problem with unixODBC on 64bit (CentOS) Linux Server
Posted on 2014-02-20
I'm having some trouble finding a solution to this so I thought I would give the experts a try. I am connecting to an ibm iSeries using an PHP odbc connection from CentOS 6.4 apache server, the problem is, any occurrence of a NULL value being returned causes the PHP script to stop processing (seriously Ive run it in debug and it just stops... doesn't cause a PDO error even...).
Anyhow, after looking into this I found the reason is because my unixODBC was compiled using the 8-byte (64bit) SQLULEN/SQLLEN (numeric length) which i have verified by running odbcinst -j inside linux. This IS the actual spec for a 64 bit build, but since the drivers are still using a 4-byte SQLLEN/SQLULEN (possibly even SQLINTEGER), it causes the script to fail, since NULL is actually being interpreted by the driver as 0xFFFFFFFF and the script doesn't know what to do with it.
Now I have gotten around this for the most part just making sure that columns selected with Outer joins use coalesce to replace the null value with '' but I have come across a query that this will not work for (its a right outer join that always needs one result returned so its joined on several fields OR field IS NULL)
Anyhow, I was hoping someone could explain to me how to change the unixODBC build on this system to a 4-byte SQLLEN/SQLULEN which was explained as one of the options for fixing this (The other I found was to find each driver that had problems and fix it so it uses the 8-byte SQLLEN/SQLULEN, but since this site does work on the ibm server it runs on currently I decided this is the better option -- fix one or find all and fix each one sounded unnecessary) Anyhow please help. Thank you.