I’m trying to insert a clob into Oracle. If I try this with an OdbcConnection it does not insert the data into the database. It returns 1 row affected and no errors but nothing is inserted into the database.
It does work with an OracleConnection. However, using the Microsoft OracleClient makes our webservices often crash with an AccessViolationException (Attempted to read or write protected memory. This is often an indication that other memory is corrupt.). This happens a lot when we use OracleDataAdapter.Fill(dataset). So using this doesn’t seem like an option.
Is there any way to insert/update clobs with more then 4.000 characters from .Net with an OdbcConnection?
I haven’t worked on the .NET platform in awhile, so this is from memory.
To the best of my knowledge, OdbcConnection’s adapter for Oracle is ancient and you cannot insert/update more than 4,000 characters at a time. You can write a stored procedure to transfer and update the CLOB 4,000 characters at a time, but that seems like a arduous and inefficient means to support an aging library.
So, MS’s OracleConnection may be a better path to debug. AccessViolationException is most often cause by the Distributed Transaction Controller (msdtc.exe) not being started, though there are numerous other potential causes (including faulty hardware).
Before you investigate the exception, there is a third connection library to consider. Oracle’s DataAccess Components (ODAC ODP.NET), which should be included with your database license. It’s much better supported than OdbcConnection and should bypass OracleConnection’s exception throwing.