My Oracle Support Banner

Setting CURRENT_SCHEMA Has No Effect When Working With User-Defined Types (Doc ID 1580729.1)

Last updated on MARCH 08, 2017

Applies to:

JDBC - Version 9.2.0.1 to 12.1.0.1.0 [Release 9.2 to 12.1]
Information in this document applies to any platform.

Symptoms

When using the JDBC driver, setting CURRENT_SCHEMA appears to have no effect against user-defined types.

Consider the following example:
* User1 creates a user-defined type.
* User2 is granted execute privileges to this type via a role, and creates a private synonym for this type.
* User3 is granted execute privileges to this type via a role, but creates no synonyms.

* You set CURRENT_SCHEMA to be User2, either via a trigger, or directly within the Java code with lines similar to the following:

  Statement alterStatement = conn.createStatement();
  alterStatement.execute("alter session set current_schema=User2");


Your Java program calls createDescriptor() for this type. The result:
* User2 works
* User3 fails.

When using the JDBC OCI driver, the failure consists the following error:
ORA-4043: Object does not exist

When using the JDBC Thin driver, the failure consists of the following error:
java.sql.SQLException: invalid name pattern

This behavior reproduces for every currently-supported version of the JDBC driver.

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
Cause
Solution
References


This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not been subject to an independent technical review.
My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.