Page 1 of 1

OutOfMemory

Posted: Wed 09 Oct 2013 10:34
by Nic
*I`m writing in English to make topic readable for bigger audience.

The problem is as simple as an apple - to insert 2GB into sql server`s varbinary(max) field.

Code: Select all

  { 
CREATE TABLE [dbo].[tmp](
	[bin] [varbinary](max) NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
insert into tmp (bin) values(:bin)
}
  if OpenDialog1.Execute then
  begin
    MSQuery1.ParamByName('bin').LoadFromFile(OpenDialog1.FileName ,ftBlob);
    MSQuery1.Execute;
  end;
Unfortunately, even on 600 MB file it fails with OutOfMemory exception, the same as ADO did for ages.
Could you please double check parameters handling routines.


And, yes, I know, I can split files into pieces and store/upload/select them as pieces - currently not an option.

Latest trial SDAC & x86 app, delphi 2010.

Re: OutOfMemory

Posted: Wed 09 Oct 2013 11:21
by AlexP
Hello,

To work with large BLOB data, you can use the TCustomMSDataSet.GetFileStreamForField method. More detailed information can be found in the documentation

Re: OutOfMemory

Posted: Wed 09 Oct 2013 11:42
by Nic
---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class EMSError with message 'FILESTREAM feature doesn't have file system access enabled.'.
---------------------------
Break Continue Help
---------------------------


we are not using filestreams. the goal is to pass really big varbinary(max) parameter to, let`s say, stored procedure.
But I`ve got an idea of filestreams.

Any suggestions on root problem?

Re: OutOfMemory

Posted: Thu 10 Oct 2013 12:15
by AndreyZ
The point is that the maximum amount of memory the process can allocate in Windows x86 is 2 GB. You can find the information about this at http://msdn.microsoft.com/en-us/library ... s.85).aspx . There, you can also find the information about how to increase this limit up to 3GB.
The only other solution is to use the FILESTREAM feature of SQL Server that is intended to cope with problems of transferring such amount of data to the server.