Exceptions

Exception: Maximum number of open statements exceeded

SYMPTOM

The client received the following error:

Maximum number of open statements (1000) exceeded.

CAUSE

The error occurs when a database connection reaches the server‑side limit of 1000 unclosed SQL statements. This can occur when an application does not close cursors or result sets correctly.

SOLUTION

Close all cursors and result sets promptly. For example, in Java, declare Connections, Statements, and ResultSets in try blocks or explicitly call Connection.close(), Statement.close(), and ResultSet.close() to close connections, cursors, and result sets after completing database operations.

The maximum number of open SQL statements is configurable on the server. If the application cannot be changed to close statements promptly, increase the limit by setting the MAX_CONNECTION_OPEN_STATEMENTS system property.