Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

11g Migration Errors

850416Mar 25 2011 — edited Mar 25 2011
Hi,

My Project gets working fine with 10g, due to the advent i got migrated to 11g.
I had heard from some sources that the problem occurs due to TWO PHASE COMMIT.
I want to check you with what may be the effects from Migration from 10 to 11g.
The Scenario is explained below.

A DAO used to get UserId and store it as a Foreign key in another table, Based on the foregin key all the other details are inserted in the comming tables.
May be consider the below repersented as a single transcation where multiple commits are present subsequently(Business Need), At 10g, When there is a commit in First Procedure the row gets commited and the foregin key gets inserted.
But in 11g, due to the effects of two phase commit The First procedure is not getting commited and the foregin key is not set which causes a
Parent key Violation exception,,,Help me with this....

public Long createUser(InternetUserView internetUserView,Long bankId) throws DAOServiceException, DAOSystemException{
Connection connection = null;
CallableStatement callableStatement = null;
String sql = null;
Long id = null;
try {
sql = "{? = call abc(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
connection = this.getConnection();
callableStatement = connection.prepareCall(sql);
-----
----
callableStatement.executeQuery(); //While this procedure gets executed, a commit is available inside the procedure.....

id = new Long(callableStatement.getLong(1));

internetUserView.setId(id); //When this id is obtained, it is set as a foregin key in a table.

this.insertData(internetUserView); //This again calls another DAO, where a procedure with a commit is available.

this.insertData1(internetUserView); //Again this is a DAO, with commit available.
return id;
} catch (SQLException e) {
log4Debug.severeStackTrace(e);
throw new DAOSystemException(MSG_017,MSG_017,e);
} finally {
cleanupDBConnectionStatement(callableStatement,connection);
}
}

Error Obtained in 11g Environment.....

.......-FATAL: java.sql.SQLSyntaxErrorException: ORA-02089: COMMIT is not allowed in a subordinate session
ORA-06512: at "...", line 5517
ORA-02291: integrity constraint (.....) violated - parent key not found
ORA-06512: at line 1

java.sql.SQLSyntaxErrorException: ORA-02089: COMMIT is not allowed in a subordinate session
ORA-06512: at "....", line 5517
ORA-02291: integrity constraint (.....) violated - parent key not found
ORA-06512: at line 1
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)

Edited by: user9295060 on 25 Mar, 2011 8:45 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 22 2011
Added on Mar 25 2011
1 comment
212 views