I have an Java application running on a Weblogic Server and Connecting to Oracle 11g DB server.
In the application i make a call to a DB Procedure and pass a parameter to it which communicates and calls multiple other procedures.
When i test the Procedure independently, it works perfectly and as expected.
The issue comes when i call the Procedure from Java Application.
The Procedure gives an error:
ORA-06508: PL/SQL: could not find program unit being called
The Backtrace leads to a call to a procedure that exists in another Schema and has a synonym in my current schema.
Please help if anybody else has faced the same issue or a similar one.
Edit#1:
Sample Code for Calling DB Proc
CallableStatement cstmt = null;
private Connection dbConn = null;
HashMap hashMap = new HashMap();
hashMap.put(DBDRIVER, driverType);
hashMap.put(USERID, userName);
hashMap.put(PASSWORD, password);
hashMap.put(SID, dbName);
hashMap.put(IPADDRESS, intDBServer);
hashMap.put(PORT, dbPort);
dbConn = (Connection)cmmObj.connect(hashMap);
cstmt = dbConn.prepareCall(queryToRun);
cstmt.setString(1, ReqId);
cstmt.executeUpdate();
Proc Call is { call Proc_CALL(?) }
I have probably found the issue. Although it seams weird to hear it but it seems to work:
The system i was working on has 3 Schema in connection.
One is the Staging Schema from which all the calls are made.
Second is the Main Schema to which calls were made. The Called Procedure existed in this Schema.
The third is another schema where a procedure existed that was being called from Main Schema Procedure.
Simplified:
The Grants to the CoSchema were available to the Main Schema, but not to the Stage Schema.
Although as per theory if Any Procedure is being granted to a schema then all inside calls to any other procedures should not matter.
but in this case when i gave the grant to Stage Schema, then everything seemed to work perfectly.
If any one has a solution to this then please share the reason for the same.