Insert 3 Gb binary file to oracle blob using Ado.net oracleclient

K

kapatel

I was trying to insert 3Gb binary file to oracle 10g BLOB Field using
ADO.Net
The application uses Oracle Transaction .
Now I have tried to read the file using following code (C#)
string filePath = aFilePath ;
FileStream fls = new
FileStream(aFilePath,fileMode.open,FileAccess.Read);
byte[ ] blob = new byte[fls.length] ; // here I am Getting the error
fls.Read(blob,0,System.Convert.ToInt32(fls.Length));


The error was Arithmetic operation overflow .
After that tried to declare the array using actual no .
byte[] blob = new byte [1700000000] It is not giving the error (1.7
GB value)
byte[] blob = new byte [2000000000] Gives error of overflow (2 Gb
Value)
These nos are within the int32 limit .

The main purpose of the application is to insert 3 gb binary file in
the oracle 10gb
Database using the Ado.net application .(.Net Frame work 1.1 , C# ,
visual studio
2003 )
How I can read the 3 GB binary file using .net and store all the bytes
in array .
I do not want to update the record so I would like to assign the Array
of byte
as parameter Value as mention below.

OracleParameter pBlob = new
OracleParameter("I_MMS_DOC_BLOB_DATA",OracleType.Blob);
pBlob.Direction = ParameterDirection.Input ;
pBlob.Value = blob; // parameter of Array

fls.length is long but I am also not able to use the max value
of the int32 . Is there any limit on arraysize in .net 1.1 or there
is any other way to store all the bytes in the array .
 
F

Frans Bouma [C# MVP]

I was trying to insert 3Gb binary file to oracle 10g BLOB Field using
ADO.Net
The application uses Oracle Transaction .
Now I have tried to read the file using following code (C#)
string filePath = aFilePath ;
FileStream fls = new
FileStream(aFilePath,fileMode.open,FileAccess.Read);
byte[ ] blob = new byte[fls.length] ; // here I am Getting the error
fls.Read(blob,0,System.Convert.ToInt32(fls.Length));


The error was Arithmetic operation overflow .
After that tried to declare the array using actual no .
byte[] blob = new byte [1700000000] It is not giving the error (1.7
GB value)
byte[] blob = new byte [2000000000] Gives error of overflow (2 Gb
Value)
These nos are within the int32 limit .

The main purpose of the application is to insert 3 gb binary file in
the oracle 10gb
Database using the Ado.net application .(.Net Frame work 1.1 , C# ,
visual studio
2003 )
How I can read the 3 GB binary file using .net and store all the
bytes in array .
I do not want to update the record so I would like to assign the
Array of byte
as parameter Value as mention below.

OracleParameter pBlob = new
OracleParameter("I_MMS_DOC_BLOB_DATA",OracleType.Blob);
pBlob.Direction = ParameterDirection.Input ;
pBlob.Value = blob; // parameter of Array

fls.length is long but I am also not able to use the max value
of the int32 . Is there any limit on arraysize in .net 1.1 or there
is any other way to store all the bytes in the array .

IMHO it's better to leave BIG files out of the db on a separate disk
volume and use references inside the DB to access the files. Adding
very large files/blobs will cause more overhead inside the db than you
would have when you're reading the large files from a disk volume.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top