OutOfMemory

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Nic
Posts: 2
Joined: Wed 09 Oct 2013 10:23

OutOfMemory

Post by Nic » Wed 09 Oct 2013 10:34

*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.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: OutOfMemory

Post by AlexP » Wed 09 Oct 2013 11:21

Hello,

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

Nic
Posts: 2
Joined: Wed 09 Oct 2013 10:23

Re: OutOfMemory

Post by Nic » Wed 09 Oct 2013 11:42

---------------------------
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?

AndreyZ

Re: OutOfMemory

Post by AndreyZ » Thu 10 Oct 2013 12:15

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.

Post Reply