java.sql.SQLException: ORA-01001: invalid cursor:ORA-02089: COMMIT is not allowed in a subordinate s [message #471055] |
Thu, 12 August 2010 02:06 |
ram anand
Messages: 244 Registered: February 2008 Location: india
|
Senior Member |
|
|
Hi,
I am calling a function in Java as below
prepareCall()[2097] ( {? = call XXX_pkg.create_new('MT', ?, ?, ?, ?, ? )
but when i try to execute this it throes below error
Caused by: javax.ejb.EJBException: nested exception is: java.sql.SQLException: ORA-01001: invalid cursor
ORA-06512: at "SYS.DBMS_SYS_SQL", line 902
ORA-06512: at "SYS.DBMS_SQL", line 19
ORA-06512: at "XXXX.DDL_EXEC_PKG", line 111
ORA-02089: COMMIT is not allowed in a subordinate session
but when i execute in the DB Toad it works fine and the package executed successfully ,so what colud be the issue for the same.
|
|
|
|
Re: java.sql.SQLException: ORA-01001: invalid cursor:ORA-02089: COMMIT is not allowed in a subordina [message #471061 is a reply to message #471055] |
Thu, 12 August 2010 02:17 |
|
Michel Cadot
Messages: 68716 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
ORA-02089: COMMIT is not allowed in a subordinate session
*Cause: COMMIT was issued in a session that is not the two-phase commit
global coordinator.
*Action: Issue commit at the global coordinator only.
You Java program is in a distributed transaction. Your TOAD session was not.
By the way, DO NOT try to validate something with TOAD, this is not validation from Oracle point of view as you add TOAD bugs to Oracle issues. Use SQL*Plus.
One more reason to NOT commit inside a procedure: ONLY the caller knows when to commit not the called one.
Regards
Michel
[Updated on: Thu, 12 August 2010 02:19] Report message to a moderator
|
|
|
|
|
|
|
|