Re: Commit

From: Bjorn Abelli (DoNotSpam.bjorn_abelli_at_hotmail.com)
Date: 03/04/04

  • Next message: Peter Kirk: "Oracle and BLOB"
    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


  • Next message: Peter Kirk: "Oracle and BLOB"

    Relevant Pages

    • Re: Close and Dispose argument
      ... > fact that even Microsoft is not clear on the issue. ... > connections from the pool is still a debate. ... > method removes the conneciton from the connection pool". ... > Your issue was forwarded to us here at Microsoft Courseware Support. ...
      (microsoft.public.dotnet.framework.adonet)
    • Close and Dispose argument
      ... here is an email conversation between me and Microsoft ... connections from the pool is still a debate. ... Programming with Microsoft ADO.NET" module 2, p 18: "Calling the Dispose ... method removes the conneciton from the connection pool". ...
      (microsoft.public.dotnet.framework.adonet)
    • Re: MinPoolSize behaviour
      ... Min Pool Size, The first time you open a connection we will open the 1 ... > Is the pool created forever? ...
      (microsoft.public.dotnet.framework.adonet)
    • Re: Commit
      ... because as I suspected the commit is without effect. ... > each executed statement has automatically been commited, as autocommit by ... > rolled back when the connection closes if no explicit commit has been done ... The application uses a connection pool for connections. ...
      (comp.lang.java.databases)
    • Re: Q:Multithreaded ADO.Net Connections Are Non Pooled?
      ... different you get a new pool. ... > the process/app domain differences, does running on a thread created by ... If you're using SSPI, each connection must be ... >> connect to the SQL Server machine, ...
      (microsoft.public.dotnet.framework.adonet)