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

From Radosław Smogura
Subject Re: Fwd: Postgres JDBC, WS and commit
Date
Msg-id f83a9c836c07ac5ff6f93544c5752488@mail.softperience.eu
Whole thread Raw
In response to Re: Fwd: Postgres JDBC, WS and commit  (mephysto <mephystoonhell@gmail.com>)
List pgsql-jdbc
On Mon, 14 May 2012 06:55:25 -0700 (PDT), mephysto wrote:
> Excuse me but I'm really confused, I did many tests, but I'm not sure
> about
> results. If I understand it, using glassfish JDBC connection pool, if
> a
> thread requires a connection to database, glassfish assign one from
> pool to
> thread and commit is executed at the end of thread, not on every
> stored
> function launch.
>
> I would, if it is possible, the commit is executed every write stored
> function.
>
> A this point, I would to know if this goal is achievable and if use
> of
> commit that I wand is admissible. Finally, I would to know, why
> commit is
> execute by deafult only one time at the end of thread.
>
> Thanks in advance and excuse me newly.
>
> Mephysto
>
> --
> View this message in context:
>
> http://postgresql.1045698.n5.nabble.com/Postgres-JDBC-WS-and-commit-tp5697657p5708644.html
> Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.

If you are using non transactional connection then commits and
rollbacks may not be performed by transaction manager (I haven't made
such tests, but I know connection is not bound to transaction manager),
when e.g. EJB request ends. Here is short description
http://docs.oracle.com/cd/E19798-01/821-1752/beamu/index.html - this is
not standard J2EE behavior. This is why I suggest you to operate with
REQUIRES_NEW, and slightly rebuilding if required your application. You
will achieve same result, and your application will be portable, as well
you have less risky points in application.

For each connection you take from pool you gets new connection.

If you want that commit will be called by stored procedure, call commit
after procedure call or do something like this

@EJB
EJB self

void doSoemthinf() {
self->callProcedure();
}

@(REQUIRES_NEW)
callPorcedure() {
jdbc chain;
}

In both cases new connection will be taken from pool.

If you have more questions, write prv message. Removing pgsql-jdbc from
CC.

Regards

pgsql-jdbc by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Re: Issues with IN-OUT parameters for Array of Objects in EDB using Java
Next
From: jonykapil
Date:
Subject: Re: Issues with IN-OUT parameters for Array of Objects in EDB using Java