Discussions
Categories
- 385.5K All Categories
- 4.9K Data
- 2.5K Big Data Appliance
- 2.4K Data Science
- 453.4K Databases
- 223.2K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 47 Multilingual Engine
- 606 MySQL Community Space
- 486 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.2K ORDS, SODA & JSON in the Database
- 585 SQLcl
- 4K SQL Developer Data Modeler
- 188K SQL & PL/SQL
- 21.5K SQL Developer
- 46 Data Integration
- 46 GoldenGate
- 298.4K Development
- 4 Application Development
- 20 Developer Projects
- 166 Programming Languages
- 295K Development Tools
- 150 DevOps
- 3.1K QA/Testing
- 646.7K Java
- 37 Java Learning Subscription
- 37.1K Database Connectivity
- 201 Java Community Process
- 108 Java 25
- 22.2K Java APIs
- 138.3K Java Development Tools
- 165.4K Java EE (Java Enterprise Edition)
- 22 Java Essentials
- 176 Java 8 Questions
- 86K Java Programming
- 82 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 208 Java User Groups
- 25 JavaScript - Nashorn
- Programs
- 667 LiveLabs
- 41 Workshops
- 10.3K Software
- 6.7K Berkeley DB Family
- 3.6K JHeadstart
- 6K Other Languages
- 2.3K Chinese
- 207 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 474 Portuguese
Reading OracleBlob throws exception when InitialLOBFetchSize is > 0

Hello,
using ODP.NET, I'm having issue when reading blob field as stream (using GetOracleBlob),
I don't know where to report a bug, so putting it here.
i'm using Oracle.ManagedDataAccess Nuget package version 19.10.0 (latest)
1. Have InitialFetchLOBSize is > 0
2. get blob stream with 'GetOracleBlob'
3. read first N bytes, but less than InitialFetchLOBSize
4. then read next portion of bytes, which would go over InitialFetchLOBSize cached bytes.
Result:
it throws exception
"Source array was not long enough. Check srcIndex and length, and the array's lower bounds."
at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
at System.Array.Copy(Array sourceArray, Int64 sourceIndex, Array destinationArray, Int64 destinationIndex, Int64 length)
at OracleInternal.ServiceObjects.OracleBlobImpl.Read(Int64 locatorOffset, Int64 numBytesToRead, Int64 outBufferOffset, Byte[]& outBuffer)
at Oracle.ManagedDataAccess.Types.OracleBlob.Read(Byte[] buffer, Int32 offset, Int32 count)
To give example with specific numbers:
- InitialFetchLOBSize=32,
- read first 16 bytes (or any number under 32, or you can just set Position to 16, or 31, doesn't matter)
- read next 32 bytes (so requested data chunk will read some of already cached data and some new)
sample code:
command.CommandText = @"select BLOB from table";
command.InitialLOBFetchSize = 32;
var reader = command.ExecuteReader()) {
while (reader.Read()) {
if (reader.IsDBNull(0)) continue;
using (var blob = reader.GetOracleBlob(0)) {
blob.Position = 16;
// this will throw exception
blob.Read(buffer, 0, 64);
}
}
Best Answer
-
I was able to reproduce the problem once I added a second row of LOB values. I filed bug 32190103 to track the issue.
Answers
-
I've just discovered there's same issue when InitialLOBFetchSize=-1 (get whole blob),
and you read past 32KB
(so read first 4KB, and then try reading next 32KB in one chunk)
-
I am able to execute your code successfully against a 19c DB. Is the problem the buffer byte array that is not large enough?
-
buffer is large enough, 1MB
testing against "Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production",
but i was pretty sure it's client problem
-
I was able to reproduce the problem once I added a second row of LOB values. I filed bug 32190103 to track the issue.
-
where can I check for a bug status, to be up to date?
-
If you or a member of your team have an Oracle Support account, you can log into https://support.oracle.com/
From there, you can search on the bug number to get its status.
-
We've identified the root cause and will have a fix for this bug. The planned patch is set for the October Release Update. As a temporary workaround, please set the OracleBlob.Position as 0 or use OracleBlob.Value instead.