Re: Commit
From: Bjorn Abelli (DoNotSpam.bjorn_abelli_at_hotmail.com)
Date: 03/04/04
- Previous message: Andree Große: "Re: Commit"
- In reply to: Peter Kirk: "Re: Commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 4 Mar 2004 14:47:47 +0100
"Peter Kirk" wrote...
> Hi, thanks for the answers. I am wondering now why the
> program is made as it is, because as I suspected the
> commit is without effect. Autocommit is in effect, and
> each individual insert is committed as it is executed.
>
> If you have time I would be grateful if you could look
> at some more questions I have below....
> The application uses a connection pool for connections.
> So what is meant by "close"? When I release a connection
> back to the pool? Or when the pool shuts down and closes
> the connections?
That's a completely different cup of tea... :-)
> (I don't really know how pools work, but I assume that
> the pool holds a set of connections open to the database
> which it issues to clients when they call "get", and when
> the client calls "close" then the pool doesn't actually
> close the connection but just makes it available again
> to other clients).
That *should* be a correct assumption.
However, as there is one more layer when dealing with pooled connections
rather than single connections, we can't be really sure what's happening in
that layer.
This is dependant on several things, such as what drivers are used, if it's
used in some container, what transaction manager is used, etc.
> So say I get a connection from the pool, set auto-commit
> to false on the connection, and then release the connection
> to the pool again: can I risk that the next time I ask for
> a connection, and happen to get the same connection object
> again, that the auto-commit attribute remains false? Or
> should the pool handle setting all connection attributes
> to the correct deafult values each time?
The "supposed" way things should be handled, is in the same way as if it
were single connections.
This supposition should consequently be that when a pooled connection gets
the message "close", if autoCommit is set to false and no commit has been
done, there should be a rollback of the latest transactions before the
connection is put back into the pool for reuse.
However, to be certain, you should look into if the pooling is handled by a
container with a specific transaction manager, and the documentation for
them.
// Bjorn A
- Previous message: Andree Große: "Re: Commit"
- In reply to: Peter Kirk: "Re: Commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|