[Mono-bugs] [Bug 350408] Retrieving a BLOB from a stored proc fails with Object reference not set to an instance of an object

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Dec 21 14:21:40 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=350408

User don_dischner at cable.comcast.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=350408#c1


Don Dischner <don_dischner at cable.comcast.com> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
                 CC|                                                |don_dischner at cable.comcast.com




--- Comment #1 from Don Dischner <don_dischner at cable.comcast.com>  2007-12-21 12:21:39 MST ---
-- My comments were cut off, here is the full string

Using System.Data.OracleClient with Oracle 10g on RH5.
I can retrieve a BLOB from a table using ExecuteReader and a sql select string,
but cannot retrieve the blob from a stored proc.
The sql being executed in both cases is "select info1 from asset" where info1
is defined as a BLOB.

// ExecuteReader Code - This works
OracleCommand rcmd = _connection().CreateCommand();
rcmd.CommandText = "SELECT info1 from asset";
OracleDataReader reader2 = rcmd.ExecuteReader();
if (!reader2.Read())
{
    OracleLob lob2 = reader2.GetOracleLob(0);
    Console.WriteLine("  LENGTH: {0}", lob2.Length);
}

// ExecuteNonQuery Code - This fails
OracleCommand command = new OracleCommand("pkg_read.asset_read", _connection);
command.CommandType = System.Data.CommandType.StoredProcedure;
OracleParameter parameter = new OracleParameter("tableCursor",
OracleType.Cursor);
parameter.Direction = ParameterDirection.Output;
command.Parameters.Add(parameter);

command.ExecuteNonQuery();

OracleDataReader reader = (OracleDataReader) parameter.Value;

while (reader.Read()) 
{
    OracleLob lob2 = reader2.GetOracleLob(0);
    Console.WriteLine("  LENGTH: {0}", lob2.Length);    // This FAILS here
}


When I try and access lob2.Length or lob2.Value I get the 'Object reference not
set to an instance of an object' error.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list