"Stream read error" using TLobLocator.SaveToFile

Hi!

I'm using the code bellow to write a LOB to a file. When the file is too big (above 300 Mb), sometimes I receive a "Stream read error" or an "Invalid handle" error. This seems to occour more frequently when my application is being executed on a Windows 2003 Server.

vLobLocator := Qr_SaveCLOB_.LOBField(0);
vLobLocator.Seek(vLobLocator.Size * -1, soFromEnd);
vLobSize := vLobLocator.Size;
if not vLobLocator.IsNull then
 
Hi, Marco!

Each error occours in the following lines:

vLobLocator.Read(vBuffer, 32767) - "Invalid handle"
vLobLocator.SaveToFile(vPathSaida) - "Stream read error"

Thanks.
 
Normally this indicates that the TLOBLocator is not properly initialized, but you already check for IsNull, so this should be okay. Can you log the value of TLOBLocator.Size in case of this error?
 
Hi, Marco!

The problem has been solved! It seems there was something to do with the session we were using, shared with other activities in the system.

Now, we are using a dedicated session and everything works fine.

Thanks for your atention!
 
Back
Top