Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Базы данных под .NET > запись blob в oracle


Автор: libman 17.1.2009, 12:23
добрый день

есть код

Код

OracleCommand WriteOracleCommand = new OracleCommand("INSERT INTO Table(ID, SIZE_BODY, BODY) VALUES (Seq1.NEXTVAL, :size_body, :body)", Connection);
//формируем BLOB и SIZE_BODY поля
byte[] ByteBody = new byte[SizeRow];
Random r = new Random();
r.NextBytes(ByteBody);
OracleLob blob=new OracleLob

WriteOracleCommand.Parameters.Add("body", OracleType.Blob).Value = ByteBody;
WriteOracleCommand.Parameters.Add("size_body", OracleType.Number).Value = ByteBody.Length;
Connection.Open();
WriteOracleCommand.ExecuteNonQuery();
Connection.Close();


при задании парметра
 
Код

SizeRow=500000000


на строчке  
Код

byte[] ByteBody = new byte[SizeRow];

выходит ошибка

Код

Exception of type 'System.OutOfMemoryException' was thrown.


Как быть?

Автор: emmanuil 31.1.2009, 22:12
С MSDN:
The length of every dimension of an array is limited to the maximum value of the Integer data type, which is (2 ^ 31) - 1. However, the total size of an array is also limited by the memory available on your system. If you attempt to initialize an array that exceeds the amount of available RAM, the common language runtime throws an OutOfMemoryException exception.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)