| Previous | Next |
| hrBufferTruncated | hrSeekNotEqual |
hrDatabaseAttached
The exact condition reported here
hrDatabaseAttached means the database was already attached to the instance when another attach operation was requested.
The stored value is 0x880003EF (positive JET status 1007; 1007). The HRESULT carries a warning, so the call may have useful output or a valid cursor state that must be inspected. Current ESE documentation uses JET_wrnDatabaseAttached for the corresponding published JET condition.
The first useful distinction is that already attached does not mean the database is open in the current session or that its path matches a second textual spelling. Start by recording the canonical database path, instance identity, attach options, and the component that owns the existing attachment.
Objects and state involved
| Diagnostic layer | database attachment/open mode and ownership by an ESE instance |
|---|---|
| Relevant API surface | attach, open, initialization, recovery, and instance lifecycle operations |
| Code-specific condition | the database was already attached to the instance when another attach operation was requested |
| Narrow corrective direction | reuse the established attachment through the owning instance and make attach/detach ownership explicit |
Attachment belongs to an instance, while an open database ID belongs to a session. Read-only and already-attached warnings can be valid operating modes but constrain later calls.
Adjacent conditions
This result specifically means that already attached does not mean the database is open in the current session or that its path matches a second textual spelling. Related values below can appear in the same workflow but require a different response:
hrFileOpenReadOnly | the database file was opened in read-only mode and the resulting handle cannot support logged updates |
|---|---|
hrLoggingDisabled | the requested operation requires transaction logging but the instance currently has logging inactive |
hrMissingRestoreLogFiles | hard recovery cannot reach consistency because one or more mandatory restore logs are absent |
Diagnostic record
- Code-specific observation: record the canonical database path, instance identity, attach options, and the component that owns the existing attachment.
- Attach/open flags: capture the value and timestamp from the first occurrence.
- File attributes and recovery state: capture the value and timestamp from the first occurrence.
- Instance and session IDs: capture the value and timestamp from the first occurrence.
- Canonical database path: capture the value and timestamp from the first occurrence.
Actions that can make diagnosis worse
- Do not detach a database merely to silence a warning without checking owners.
- Do not attempt logged writes through a read-only path.
Corrective path
- Record it,
0x880003EF, the API name, the current phase, and all live context or file owners. - Verify the condition by recording the canonical database path, instance identity, attach options, and the component that owns the existing attachment.
- Apply only the targeted fix: reuse the established attachment through the owning instance and make attach/detach ownership explicit.
Acceptance criteria for a fix
A useful regression test should force the condition “the database was already attached to the instance when another attach operation was requested”, call one documented API transition, and assert the exact HRESULT.
Technical references
- ESE files and lifecycle — API ordering, file semantics, warning/error interpretation, or recovery behavior relevant to this HRESULT.
- JetInit and recovery
- ESE warning table
- Microsoft JET_ERR enumeration
Looking for a different code? Search another status or error code.
