Informix Error -359
-359 Cannot drop or rename the current database or any open database.
The database that is currently open cannot be dropped or renamed. First use the CLOSE DATABASE statement or end the applications that access the database; then you can drop it.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-359 is closely related to -358: DROP DATABASE/RENAME DATABASE requires the target database
to not be currently open — by the issuing session or by any other session/application, not just
the one running the statement.
- The current session has the target database open and is attempting to drop or rename it
without first issuing
CLOSE DATABASE. - A different session or application still has the database open, even though the issuing session itself is disconnected from it.
- A connection pool holding idle connections against the target database, keeping it "open" from the server's perspective even without active queries running.
Solutions / Resolution
- Close the database in the current session with
CLOSE DATABASEbefore attemptingDROP/RENAME, per the official guidance. - Terminate other applications/sessions accessing the database if the block persists after closing it locally — check for other open connections.
- For connection-pooled applications, ensure the pool releases connections to the target database before attempting the drop/rename, since idle pooled connections can still count as "open."
Examples
Closing locally before dropping
DATABASE sales;
CLOSE DATABASE;
DROP DATABASE sales;
Checking for other sessions still holding it open
onstat -g ses
-- lists active sessions; check each session's detail
-- (onstat -g ses <sid>) for the database it's currently
-- connected to, then coordinate with or terminate the
-- relevant ones before retrying
Diagnostic Checks
- Confirm the current session has closed the database before attempting the drop/rename.
- Check
onstat -g sesfor other sessions still connected to the target database. - Check for connection-pooled applications that may be holding idle connections open against it.
Related Errors / Related Topics
- -358 — "Must close current database before CREATE, START or ROLLFORWARD." A closely related restriction requiring a database to be closed before a different set of statements.
- -330 — "Cannot create or rename the database." A related database-lifecycle error, on creation rather than drop/rename.
Check for other sessions, not just your own, still holding the database open — an idle connection-pool member is a common overlooked culprit.