Re: Informix blobs and VB
Posted in 1996
Topics: Storage & Space Management, Connectivity: ODBC / JDBC / .NET
> I am using visual basic 4.0 16bit. I successfully connected using ODBC. > I have a Tiff format file which is about 300K size. I used a AppendChunk > and GetChunk Methods. I stored the data from the tiff file by chunks of 32K > appending them to each other. So, it stored all of the 300K in Byte field > in Informix. When I get it back to the temporary file and tried to open it > I get a message that file corrupted. If I am using the same code for the file > less then 64K it works fine but for bigger files it change the data when I read > it in Informix Byte field. I had the same problem when accessing an oracle database. It turned out the fieldsize function the OraField object provides would only return the correct value for sizes less than 64k, otherwise it returns -1 (I solved the problem inserting a colum I stored the correct size in) Furthermore, I used an array of bytes to store the blocks I was going to read/write which I 'redimed' according to the amount of data I was going to move. VB reserves always 1 byte more than you specify, e. g. ... redim bytearr(30000) dyna.fields("obj").appendchunk bytearr ... would write 30001 bytes to the database! This caused corrupted files to me, too.. hope I could help Timo -------cut---------- timos@kirchheim.netsurf.de