Fwd: Postgres JDBC, WS and commit - Mailing list pgsql-jdbc

From Kevin Carr
Subject Fwd: Postgres JDBC, WS and commit
Date
Msg-id CAC92xsrzAeLRHngP2et3j=bmAAw9M257tdzKr1KN9tfpVm=sGw@mail.gmail.com
Whole thread Raw
In response to Postgres JDBC, WS and commit  (mephysto <mephystoonhell@gmail.com>)
Responses Re: Fwd: Postgres JDBC, WS and commit  (mephysto <mephystoonhell@gmail.com>)
List pgsql-jdbc
Sorry, first time post to the list, and didn't see that my answer wasn't posted to the list.

---------- Forwarded message ----------
From: Kevin Carr <kscarr73@gmail.com>
Date: Wed, May 9, 2012 at 12:03 PM
Subject: Re: [JDBC] Postgres JDBC, WS and commit
To: mephysto <mephystoonhell@gmail.com>


I can't imagine you would really want this feature at the Pool level.  A connection pool is a set of connections available to the application.  Thus saying, each time you getConnection on the pool, you have no idea which connection you are specifically getting.  You run the risk of a "Connection" on the pool being in a transaction state, and no way of getting to that specific connection to continue the transaction.

Depending on how your code is written, you could pull a connection start a transaction, and hold onto that connection through the various manipulations in a single request.  You would have more control over what is happening in the connection that way, and you are guaranteed that the connection is the same one for all manipulations you have.

You could extend the pool classes and create a "Hold" type of connection, it depends on how you have your code written.  If you have full control over how the connection is retrieved then you could easily modify to put a Session type request to get a specific connection from the pool.  It is MESSY though.


On Wed, May 9, 2012 at 10:06 AM, mephysto <mephystoonhell@gmail.com> wrote:
Hi there,
I'm using postgres-JDBC ina GlassFish application server to develop a web
service application. I made several tries with either XA and standard
driver. I use JDBC connection pool of GlassFish.
I found that transaction started into a web service operation, are closed at
the end of operation, not when in the code the connection are closed.

I am searching a solution to close transaction that permit me to close
trasaction when I want it, before end of web service operation.

Is there a way to achieve this goal?

Thanks in advance.

Mephysto

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Postgres-JDBC-WS-and-commit-tp5697657.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.

--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



--
Scott Carr




--
Scott Carr

pgsql-jdbc by date:

Previous
From: mephysto
Date:
Subject: Postgres JDBC, WS and commit
Next
From: mephysto
Date:
Subject: Re: Fwd: Postgres JDBC, WS and commit