Oracle Solution for Error ora-21522

Solution for Oracle Error ORA-21522

ORA-21522: attempted to use an invalid connection in OCI (object mode only)

What triggered the Error:

er attempted to use an invalid connection or a connection that has been terminated in an OCI environment (object mode), or user attempted to dereference a REF obtained from a connection which has been terminated.

What should we do to fix it:

sure that the connection exists and is still valid.