[英]Oracle ORA-02089 with Java
I'm getting the following error when trying to call a PL/SQL stored procedure from Java: ORA-02089: COMMIT is not allowed in a subordinate session
尝试从Java调用PL / SQL存储过程时出现以下错误:
ORA-02089: COMMIT is not allowed in a subordinate session
It tests fine from Oracle. 它可以从Oracle测试得很好。 Does anyone have any experience with this?
有人对这个有经验么?
Try this ways; 尝试这种方式;
What does the oracle documentation say about the error: oracle文档对错误的说法是什么:
COMMIT was issued in a session that is not the two-phase commit global coordinator.
COMMIT是在不是两阶段提交全局协调器的会话中发出的。
Basically you are executing a distributed transaction. 基本上您正在执行分布式事务。 As part of a distributed transaction you are trying to invoke an autonomous transaction.
作为分布式事务的一部分,您尝试调用自治事务。 This is not possible as distributed transactions are required to do a 2PC.
这是不可能的,因为分布式事务需要执行2PC。
Hmm, I think it's related to XA. 嗯,我认为这与XA有关。 It works fine when I bracket the stored procedure with AUTONOMOUS_TRANSACTION Pragma :
当我使用AUTONOMOUS_TRANSACTION Pragma括起存储过程时,它工作正常:
PROCEDURE foo (val IN VARCHAR2(4000)) is
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
INSERT INTO tbl1 VALUES (val);
DELETE FROM tbl2;
COMMIT;
END foo;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.