OCIStmtExecute Executes Successfully after Setting OCI_ATTR_CURRENT_SCHEMA to a Non-Existent Schema Twice
(Doc ID 2866958.1)
Last updated on JULY 20, 2024
Applies to:
Oracle Database - Enterprise Edition - Version 11.2.0.4 and laterInformation in this document applies to any platform.
Symptoms
An OCI code connects to the database using a valid user and query a table successfully. It then sets OCI_ATTR_CURRENT_SCHEMA to a non-existent schema and query the same table but it fails with "ORA-01435: user does not exist" which is an expected behavior. The code then sets OCI_ATTR_CURRENT_SCHEMA to the same non-existent schema and query the table again but this time the query succeeds. For example, the OCI code makes the following series of calls.
1. OCIInitialize() 13.OCIAttrSet() for OCI_ATTR_CURRENT_SCHEMA with a non-existent schema. 15.OCIAttrSet for OCI_ATTR_CURRENT_SCHEMA with a non-existent schema again. 17.OCIHandleFree() for freeing handles There's no change in the database server or client side. The issue can be seen on any RDBMS version.
2. OCIEnvInit()
3. OCIHandleAlloc() for error, service, session, server and statement
4. OCIServerAttach()
5. OCIAttrSet() for OCI_ATTR_SERVER
6. OCIAttrSet() for OCI_ATTR_USERNAME with a valid user
7. OCIAttrSet() for OCI_ATTR_PASSWORD with a valid password
8. OCISessionBegin()
9. OCIAttrSet() for OCI_ATTR_SESSION
10.OCIStmtPrepare() for a SELECT statement on a valid Table.
11.OCIDefineByPos()
12.OCIStmtExecute() <<<<<
14.OCIStmtExecute() <<<<<
16.OCIStmtExecute <<<<<
18.ExitChanges
Cause
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!
In this Document
Symptoms Changes Cause Solution References