By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,257 Members | 928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,257 IT Pros & Developers. It's quick & easy.

Re: Oracle JDBC, SQLException, COMMIT is not allowed in a subordinate session

P: n/a
I resolved this issue.

If you are using an Oracle XA DataSource, Oracle's JDBC driver
will automatically issue a COMMIT when it sees a "DROP TABLE foobar"
statement.

Oracle's JDBC driver cannot properly execute a
DROP TABLE statement unless you are using a non-XA DataSource.

With the non-XA Oracle JDBC DataSource, I can happily execute
"DROP TABLE foobar"
My configuration:

1) IBM Websphere 5.0.2
2) database: Oracle9i release 2
3) Oracle JDBC DataSource, with XA enabled
4) driver class: oracle.jdbc.xa.client.OracleXADataSource
5) a servlet that uses JTA UserTransaction's

When I execute "DROP TABLE movies", the Oracle JDBC
driver throws a SQLException.

The exception message is

ORA-02089: COMMIT is not allowed in a subordinate session

Oracle's documentation says:

{{

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.

}}

The strange thing is that I my code does not issue a COMMIT

Also, I disabled autocommit by calling

conn.setAutoCommit(false)

Here is the stack trace:

[7/19/03 12:10:02:936 PDT] 587e316 SystemErr R strMsg =
java.sql.SQLException: ORA-02089: COMMIT is not allowed in a
subordinate session
[...]
Jun 27 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
The commit is NOT issued by the driver; it is issued by the database. Log
in to sqlplus and prove it to yourself.
eg
update something
drop a table
rollback
and the update will not be rolled back.
Jim
"Anonymous" <qc******@yahoo.comwrote in message
news:3c**************************@posting.google.c om...
I resolved this issue.

If you are using an Oracle XA DataSource, Oracle's JDBC driver
will automatically issue a COMMIT when it sees a "DROP TABLE foobar"
statement.

Oracle's JDBC driver cannot properly execute a
DROP TABLE statement unless you are using a non-XA DataSource.

With the non-XA Oracle JDBC DataSource, I can happily execute
"DROP TABLE foobar"
My configuration:

1) IBM Websphere 5.0.2
2) database: Oracle9i release 2
3) Oracle JDBC DataSource, with XA enabled
4) driver class: oracle.jdbc.xa.client.OracleXADataSource
5) a servlet that uses JTA UserTransaction's

When I execute "DROP TABLE movies", the Oracle JDBC
driver throws a SQLException.

The exception message is

ORA-02089: COMMIT is not allowed in a subordinate session

Oracle's documentation says:

{{

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.

}}

The strange thing is that I my code does not issue a COMMIT

Also, I disabled autocommit by calling

conn.setAutoCommit(false)

Here is the stack trace:

[7/19/03 12:10:02:936 PDT] 587e316 SystemErr R strMsg =
java.sql.SQLException: ORA-02089: COMMIT is not allowed in a
subordinate session
[...]

Jun 27 '08 #2

P: n/a
Gentlemen,

To add a more general level to this thread: in Oracle *all* ddl statements have
an implied commit associated to them. That is: any creation, removal or change
of a database object forces a commit on the current transaction.

Regards,

Ruud de Koter.

Jim Kennedy wrote:
>
The commit is NOT issued by the driver; it is issued by the database. Log
in to sqlplus and prove it to yourself.
eg
update something
drop a table
rollback
and the update will not be rolled back.
Jim
"Anonymous" <qc******@yahoo.comwrote in message
news:3c**************************@posting.google.c om...
I resolved this issue.

If you are using an Oracle XA DataSource, Oracle's JDBC driver
will automatically issue a COMMIT when it sees a "DROP TABLE foobar"
statement.

Oracle's JDBC driver cannot properly execute a
DROP TABLE statement unless you are using a non-XA DataSource.

With the non-XA Oracle JDBC DataSource, I can happily execute
"DROP TABLE foobar"
My configuration:
>
1) IBM Websphere 5.0.2
2) database: Oracle9i release 2
3) Oracle JDBC DataSource, with XA enabled
4) driver class: oracle.jdbc.xa.client.OracleXADataSource
5) a servlet that uses JTA UserTransaction's
>
When I execute "DROP TABLE movies", the Oracle JDBC
driver throws a SQLException.
>
The exception message is
>
ORA-02089: COMMIT is not allowed in a subordinate session
>
Oracle's documentation says:
>
{{
>
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.
>
}}
>
The strange thing is that I my code does not issue a COMMIT
>
Also, I disabled autocommit by calling
>
conn.setAutoCommit(false)
>
Here is the stack trace:
>
[7/19/03 12:10:02:936 PDT] 587e316 SystemErr R strMsg =
java.sql.SQLException: ORA-02089: COMMIT is not allowed in a
subordinate session
[...]
--
--------------------------------------------------------------------------------------
Ruud de Koter HP OpenView Software Business Unit
Senior Software Engineer IT Service Management Operation
Telephone: +31 (20) 514 15 89 Van Diemenstraat 200
Telefax : +31 (20) 514 15 90 PO Box 831
Telnet : 547 - 1589 1000 AV Amsterdam, the Netherlands
Email : ru**********@hp.com

internet: http://www.openview.hp.com/products/servicedesk
intranet: http://ovweb.bbn.hp.com/itservicemanager
--------------------------------------------------------------------------------------
Jun 27 '08 #3

P: n/a
Gentlemen,

To add a more general level to this thread: in Oracle *all* ddl statements have
an implied commit associated to them. That is: any creation, removal or change
of a database object forces a commit on the current transaction.

Regards,

Ruud de Koter.

Jim Kennedy wrote:
>
The commit is NOT issued by the driver; it is issued by the database. Log
in to sqlplus and prove it to yourself.
eg
update something
drop a table
rollback
and the update will not be rolled back.
Jim
"Anonymous" <qc******@yahoo.comwrote in message
news:3c**************************@posting.google.c om...
I resolved this issue.

If you are using an Oracle XA DataSource, Oracle's JDBC driver
will automatically issue a COMMIT when it sees a "DROP TABLE foobar"
statement.

Oracle's JDBC driver cannot properly execute a
DROP TABLE statement unless you are using a non-XA DataSource.

With the non-XA Oracle JDBC DataSource, I can happily execute
"DROP TABLE foobar"
My configuration:
>
1) IBM Websphere 5.0.2
2) database: Oracle9i release 2
3) Oracle JDBC DataSource, with XA enabled
4) driver class: oracle.jdbc.xa.client.OracleXADataSource
5) a servlet that uses JTA UserTransaction's
>
When I execute "DROP TABLE movies", the Oracle JDBC
driver throws a SQLException.
>
The exception message is
>
ORA-02089: COMMIT is not allowed in a subordinate session
>
Oracle's documentation says:
>
{{
>
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.
>
}}
>
The strange thing is that I my code does not issue a COMMIT
>
Also, I disabled autocommit by calling
>
conn.setAutoCommit(false)
>
Here is the stack trace:
>
[7/19/03 12:10:02:936 PDT] 587e316 SystemErr R strMsg =
java.sql.SQLException: ORA-02089: COMMIT is not allowed in a
subordinate session
[...]
--
--------------------------------------------------------------------------------------
Ruud de Koter HP OpenView Software Business Unit
Senior Software Engineer IT Service Management Operation
Telephone: +31 (20) 514 15 89 Van Diemenstraat 200
Telefax : +31 (20) 514 15 90 PO Box 831
Telnet : 547 - 1589 1000 AV Amsterdam, the Netherlands
Email : ru**********@hp.com

internet: http://www.openview.hp.com/products/servicedesk
intranet: http://ovweb.bbn.hp.com/itservicemanager
--------------------------------------------------------------------------------------
Jun 27 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.