简体   繁体   English

从Java调用时,DB中的过程不起作用

[英]Procedure in DB not working when called from Java

I have an Java application running on a Weblogic Server and Connecting to Oracle 11g DB server. 我有一个在Weblogic服务器上运行并连接到Oracle 11g DB服务器的Java应用程序。

In the application i make a call to a DB Procedure and pass a parameter to it which communicates and calls multiple other procedures. 在应用程序中,我调用了一个DB Procedure,并向其传递了一个参数,该参数可通信并调用多个其他过程。

When i test the Procedure independently, it works perfectly and as expected. 当我独立测试该程序时,它可以完美且按预期运行。

The issue comes when i call the Procedure from Java Application. 当我从Java应用程序调用过程时,就会出现问题。

The Procedure gives an error: 该过程给出了一个错误:

ORA-06508: PL/SQL: could not find program unit being called ORA-06508:PL / SQL:找不到正在调用的程序单元

The Backtrace leads to a call to a procedure that exists in another Schema and has a synonym in my current schema. Backtrace导致对另一个模式中存在的过程的调用,该过程在我当前的模式中具有同义词。

Please help if anybody else has faced the same issue or a similar one. 如果其他人遇到过相同或相似的问题,请提供帮助。

Edit#1: Sample Code for Calling DB Proc 编辑#1:调用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(?) } 程序调用为{调用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. 我正在研究的系统具有3个架构的连接。

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: 简化:

StageSchema.Caller(Synonym)-->> StageSchema.Caller(同义词)->>

MainSchema.Proc_Call(Procedure)-->> MainSchema.Proc_Call(过程)->>

CoSchema.insideCall(Procedure). CoSchema.insideCall(过程)。

The Grants to the CoSchema were available to the Main Schema, but not to the Stage Schema. 对CoSchema的授予对主模式可用,但对阶段模式不可用。

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. 但是在这种情况下,当我将授权授予Stage Schema时,一切似乎都可以正常运行。

If any one has a solution to this then please share the reason for the same. 如果有人对此有解决方案,请分享原因。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么从浏览器调用与从 Java 调用时 Cosmos 存储过程的运行方式不同? - Why would a Cosmos stored procedure run differently when called from browser vs. called from Java? JPA调用存储过程从2 db中选择数据 - JPA called stored procedure selecting data from 2 db 从Redhat 6.2框上的Java应用程序调用时,Tesseract无法正常工作 - Tesseract not working when called from java application on redhat 6.2 box 批处理转到:从 java 调用时,eof 不起作用 - batch goto :eof not working when called from java 从另一个类调用时,Java PropertyChangeListener不起作用 - Java PropertyChangeListener not working when called from another class 从不同的类调用时,Java repaint()无法正常工作 - Java repaint() not working when called from a different class 从Java应用程序调用时,存储过程不保留写入的表 - Stored procedure doesn't preserve the table written, when called from Java app 从 oracle DB Java 过程调用 shell 脚本时,不能识别 ZE206A55E424B5E91Z 脚本 74E9769089CCE50 - When invoking a shell script from oracle DB Java procedure, the linux commands inside script are not being recognized Oracle PL / SQL-其他团队调用的过程,用于插入数据。 正在从Java调用过程 - Oracle PL/SQL - a procedure called by some other team to insert data. Procedure is being called from Java 从 java 直接调用时,https 调用工作,但从 oracle 12c 内部无法工作 - https call working when called direct from java ,but not working from inside oracle 12c
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM