| Previous | Next |
| DB_E_BADBOOKMARK | DB_E_PARAMNOTOPTIONAL |
DB_E_BADLOCKMODE
Meaning
Windows documents DB_E_BADLOCKMODE as “Lock mode is invalid”. Here, an OLE DB resource or binder operation receives a lock mode outside the modes accepted by that method or provider.
Relevant OLE DB contract
This result must be interpreted against this contract: OLE DB objects follow both COM lifetime rules and provider-specific state contracts; open dependents, ownership transfer, aggregation, callbacks and namespace identity must be traced from the exact interface call rather than inferred from a wrapper exception.
Start with the COM object that returned the result and every dependent interface or provider-owned resource involved in the call when investigating this result.
Specific conditions that produce the result
- Cause 1: the lock-mode enumeration value is invalid.
- Cause 2: a valid mode is unsupported for the selected resource type.
- Cause 3: combined bind flags request a lock semantic the provider cannot honor.
Evidence to collect before changing the system
- Evidence 1: the exact lock mode and accompanying bind flags.
- Evidence 2: the interface and URL or object type receiving the request.
- Evidence 3: provider capability metadata for share and deny modes.
Corrective actions
- Action 1: use only lock modes documented for the invoked interface.
- Action 2: choose a weaker supported mode when exclusivity is not required.
- Action 3: separate lock acquisition from unrelated bind options so failures remain diagnosable.
Retry and recovery policy
Retry rule: retry after changing the requested lock mode or resource state.
Practical incident
A namespace binder requests an exclusive lock for a provider that supports only shared reads; selecting the supported mode avoids it.
Difference from related HRESULT values
DB_E_RESOURCELOCKED means another process currently holds a conflicting lock, while DB_E_BADLOCKMODE means the requested mode itself is invalid or unsupported.
Official Microsoft references
Looking for a different code? Search another status or error code.