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

From: Ruud de Koter <ruud_dekoter_at_hp.com>
Date: Mon, 21 Jul 2003 08:52:53 GMT
Message-ID: <3F1BA9E3.F5A2EBBF_at_hp.com>


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" <qcircuit_at_yahoo.com> wrote in message
> news:3cef1aeb.0307201152.3cbf4de3_at_posting.google.com...
> > 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    : ruud_dekoter_at_hp.com

internet: http://www.openview.hp.com/products/servicedesk
intranet: http://ovweb.bbn.hp.com/itservicemanager
--------------------------------------------------------------------------------------
Received on Mon Jul 21 2003 - 10:52:53 CEST

Original text of this message