469,327 Members | 1,209 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

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

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
3 12302
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
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
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.

Similar topics

1 post views Thread by Paul | last post: by
reply views Thread by JWM | last post: by
11 posts views Thread by Markus Breuer | last post: by
19 posts views Thread by Gregor =?UTF-8?B?S292YcSN?= | last post: by
1 post views Thread by wnaveenkumar | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.