What does HRESULT 0x80040E94 (DB_E_READONLY) mean?

 
Previous Next
DB_E_NOTCOLLECTION DB_E_ASYNCNOTSUPPORTED

DB_E_READONLY

Caller requested write access to a read-only object

Exact value and result class

DB_E_READONLY has unsigned value 2147749524 (0x80040E94) and signed 32-bit value -2147217772. AllStat describes it as “Caller requested write access to a read-only object”. In this result, the caller requests write access to an object whose provider contract or current representation is read-only.

The high bit is set, so DB_E_READONLY is a failure HRESULT. Its facility is 4 (FACILITY_ITF) and its low code is 3732 (0x0E94). For DB_E_READONLY, these fields identify an interface-defined result family; they do not identify the provider instance, method, object generation or partial effects.

Contract boundary

For DB_E_READONLY, the OLE DB binder model maps URLs to row, rowset, stream or collection objects. For DB_E_READONLY, URL scope, requested object type, bind flags, asynchronous capability, locks and server reachability are independent parts of the binding contract.

Investigation of DB_E_READONLY should start with the binder or session, normalized URL, requested GUID/object type and DBBINDURLSTATUS result. Capture DB_E_READONLY before ADO, ATL, .NET or a database abstraction layer replaces the native HRESULT with a generic exception.

Evidence to collect

A useful DB_E_READONLY event records provider CLSID and version, process architecture, interface IID and method, object correlation ID, transaction state and the immediately preceding HRESULT. When recording DB_E_READONLY data involving URLs containing credentials, tenant paths and remote object names, use types, lengths, hashes or redacted identifiers rather than secrets or complete business data.

  • Evidence 1 for DB_E_READONLY: requested access flags.
  • Evidence 2 for DB_E_READONLY: resource and provider capabilities.
  • Evidence 3 for DB_E_READONLY: whether a writable parent or alternate endpoint exists.

Conditions that specifically lead to this result

  • Cause 1 for DB_E_READONLY: the resource is inherently read-only.
  • Cause 2 for DB_E_READONLY: the bind flags request write access through a read-only view.
  • Cause 3 for DB_E_READONLY: provider or server policy mounted the namespace without mutation support.

Diagnostic sequence

  1. Capture raw 0x80040E94 and symbolic DB_E_READONLY at the native call boundary.
  2. Identify the exact failing stage for DB_E_READONLY: the caller requests write access to an object whose provider contract or current representation is read-only.
  3. Retrieve all OLE DB error records for DB_E_READONLY before another COM call replaces thread error information.
  4. Compare the live object state and provider-granted capabilities with the input that produced DB_E_READONLY.
  5. Reduce the DB_E_READONLY operation to the smallest case that preserves the same binder contract.
  6. Apply one evidence-backed correction for DB_E_READONLY and verify that the result is not merely replaced by a neighboring HRESULT.

Retry and recovery

Retry rule for DB_E_READONLY: retry only after access mode or object mutability has changed. A DB_E_READONLY retry is safe only when the relevant input, object generation, capability or external state has changed. Before replaying a modifying call that returned DB_E_READONLY, determine whether rows, schema objects or URL resources were partially created or changed.

Do not turn DB_E_READONLY into an unbounded retry loop. Preserve cancellation for DB_E_READONLY and use a fresh provider object when the failed call may have left local state ambiguous.

Corrective actions

  • Action 1 for DB_E_READONLY: open the object for read access.
  • Action 2 for DB_E_READONLY: route writes through a supported mutable object.
  • Action 3 for DB_E_READONLY: do not disguise a read-only contract as a transient lock.

Practical scenario

A report archive exposes row objects for reading only; opening them without write flags avoids DB_E_READONLY. Keeping DB_E_READONLY with the method and object state makes this scenario diagnosable instead of reducing it to “database error”.

Developer and operations guidance

Code handling DB_E_READONLY should release COM objects in ownership order, retain per-row, per-column or per-property statuses, and log granted capabilities rather than only requested options. While handling DB_E_READONLY, opaque values such as HACCESSOR, HROW, HCHAPTER, DBID components and provider handles must remain scoped to the object that issued them.

Operational dashboards for DB_E_READONLY should group by provider version, interface, method and normalized failure stage. A DB_E_READONLY event must not expose passwords, tokens, full connection strings, unrestricted command text or raw row contents.

Difference from nearby HRESULT values

DB_E_RESOURCELOCKED is temporary ownership conflict, while DB_E_READONLY is a capability or policy property of the object. Telemetry and remediation for DB_E_READONLY should keep these outcomes distinct.

Official Microsoft references


Looking for a different code? Search another status or error code.