Informix and BINARY data just don't mix!
Posted in 1998
Is there any version of Informix DBMS that supports binary data? I mean besides BLOBs? Is SQL_VARBINARY supported by any version of Informix? Using the call SQLGetTypeInfo(hstmt, SQL_VARBINARY) I have determined that Informix 7.22 (Dynamic Sever Developer) does not support the data type? So how does one store and retrieve binary data? I mean in a way that would work with other DBMSs as well. I'm trying to use the miracle of ODBC to write one application that can access databases from a variety of vendors. So far DB2, Oracle8 and Sybase are under control. This is not to say that it was trivial to get them to work under the same ODBC umbrella, but I'm at a real road block with Informix. My code currently uses SQL_VARBINARY as the data type when accessing binary columns. One of the binary columns in actually the primary key. Now if I switch the code to use SQL_CHAR then I've broken my support for the other DBMSs, and I will have to investigate to see if I can change their tables to get them working again. However, I would like to beat Informix into submission if at all possible. So is there a version of Informix that supports SQL_VARBINARY? Is there anyway to write binary data without using SQL_CHAR? So far I have only one vendor specific "if" statement and it's only there for a performance gain (i.e. I can make it work easily without it). Now it looks like I might need something like: if (Informix) sqlVarBinary = SQL_CHAR; else sqlVarBinary = SQL_VARBINARY; Then use sqlVarBinary in the SQLBindParameter(...) calls rather than SQL_VARBINARY. Any thoughts? Thanks, Jim Blye (919)254-4692