Hi Tom,
I am trying out EBR feature for one of our products which uses a three schema approach for database deployment.
All tables, views are created in tables schema (TESTTBLS),
all procedures and synonyms of tables (in TESTTBLS) created in procedure schema(TESTPROCS) and
synonyms of procedures(in TESTPROCS) and synonyms of synonyms of tables(in TESTPROCS) created in user schema (TESTUSER)
The application server connects to TESTUSER which has the synonymns of procedures and tables and have the grants
to execute procedure and DMLs on tables.
Test Case
---------
I have the following table in TESTTBLS which has a BLOB column
conn TESTTBLS/TESTTBLS@XE
CREATE TABLE test_blob (
id NUMBER(15)
, image_name VARCHAR2(1000)
, image BLOB
, timestamp DATE
);
GRANT INSERT,UPDATE,DELETE,SELECT ON test_blob TO TESTPROCS,TESTUSER;
CONN TESTPROCS/TESTPROCS@XE
CREATE SYNONYM test_blob FOR TESTTBLS.test_blob;
CONN TESTUSER/TESTUSER@XE
CREATE SYNONYM test_blob FOR TESTPROCS.test_blob;
The application server connecting TESTUSER is able to insert records to blob table.
Now for enabling EBR i did the following steps as per Oracle documentation.
conn TESTTBLS/TESTTBLS@XE
REVOKE INSERT,UPDATE,DELETE,SELECT ON test_blob FROM TESTPROCS,TESTUSER;
RENAME test_blob TO test_blob_1;
CREATE OR REPLACE EDITIONING VIEW test_blob AS SELECT * FROM test_blob_1;
GRANT INSERT,UPDATE,DELETE,SELECT ON test_blob TO TESTPROCS,TESTUSER;
now i am able to select and insert data (with empty_blob())into this editioning view using sql developer from TESTPROCS and TESTUSER
schema.
But the application server throws the following error.
Caught SQL Exception: (Write BLOB value - Put Method).
SQL:
SELECT image FROM test_blob WHERE id = 1 FOR UPDATE
java.sql.SQLException: ORA-00942: table or view does not exist
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:389)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:382)
at oracle.jdbc.driver.T4C8TTILob.processError(T4C8TTILob.java:789)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
at oracle.jdbc.driver.T4C8TTILob.write(T4C8TTILob.java:178)
at oracle.jdbc.driver.T4CConnection.putBytes(T4CConnection.java:2412)
at oracle.sql.BLOB.setBytes(BLOB.java:881)
at oracle.sql.BLOB.putBytes(BLOB.java:382)
at BLOBFileExample.writeBLOBPut(BLOBFileExample.java:274)
at BLOBFileExample.main(BLOBFileExample.java:617)
Caught SQL Exception. Exiting.
java.sql.SQLException: ORA-00942: table or view does not exist
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:389)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:382)
at oracle.jdbc.driver.T4C8TTILob.processError(T4C8TTILob.java:789)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
at oracle.jdbc.driver.T4C8TTILob.write(T4C8TTILob.java:178)
at oracle.jdbc.driver.T4CConnection.putBytes(T4CConnection.java:2412)
at oracle.sql.BLOB.setBytes(BLOB.java:881)
at oracle.sql.BLOB.putBytes(BLOB.java:382)
at BLOBFileExample.writeBLOBPut(BLOBFileExample.java:274)
at BLOBFileExample.main(BLOBFileExample.java:617)
the insert (with empty_blob()) and select worked on the editioning view from application server also,
but the writing of blob failed.
When i grant the privileges on the base table this error doesnot occur.
conn TESTTBLS/TESTTBLS@XE
GRANT INSERT,UPDATE,DELETE,SELECT ON test_blob_1 TO TESTPROCS,TESTUSER;
I tried the same with a normal view instead of editioning view and the error is not thrown.
Is it a bug? If not can you explain why the grant is required for the base table.
Is there any issue if i grant the privilege on the base table and then use editoning view.
I used the sample code from
http://www.idevelopment.info for trying this(Oracle->DBA Tips->Load Binary Files to BLOB then Write Back Out to Disk - (Java))
Thanks in advance for your precious time.