Using postgresql connection in distributed environment

From: "Zoltan Fulop" <zfulop(at)csi(dot)ca>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Using postgresql connection in distributed environment
Date: 2002-04-12 20:12:48
Message-ID: scb7079c.057@toronto.csi.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,

I am using openorb, openorb transaction service, openorb implementation of JTA, and the XA classes provided by postgresql to execute distributed transactions.
When i use only one resource, the transaction commits properly (since the prepare() method does not get invoked), but when i use more then one resources in a global transaction, it seems that the prepare() call of the org.postgresql.xa.XAConnectionImpl throws an XAException indicating that it was invoked in an improper context (XAException.XAER_PROTO), which is caused by having the TxConnection.count > 0 condition. Here is a breief discription on the sequence of calls:

processA:
Create transaction (getting CosTransactions::Control)
cache it with some id.

processB: (different control of thread than processA created Control in)
get Control from processA for a specific ID.
resume CosTransactions::Current with that control.
Get XAConnection from org.postgressql.PostgresqlDataSource
register XAResource (from XAConnection) with JTA (the JTA implementation uses CosTransaction::Current to talk to the distributed transaction)
exercute some sql command using the connetion aquired from XAConnection

processC:
do the same as processB

processA: (after receiving notification from processB and processC about the completion of the task)
get the CosTransaction::Control for the id.
call commit.

When i call commit, it calls prepare() on the registered XAResources, but since the TxConnection.count is 1 it throws the exception (described above)
However if i change the code (org.postgresql.xa.XAConnectionImpl.java: around line 670) that the comparison is "txConn.count > 1" (instead of "txConn.count > 0") the transaction commits properly...

Any help is greatly apprechiated,
Thank you,
Zoltan Fulop

Browse pgsql-jdbc by date

  From Date Subject
Next Message Gautham S. Rao 2002-04-13 05:54:39 getColumnName() and getColumnLabel()
Previous Message Marin Dimitrov 2002-04-12 18:27:14 Invalid Unicode character