Q: setAutoCommit after connection.createStatement()

From: Ken (cayel_at_tjohoo.se)
Date: 10/13/03


Date: 13 Oct 2003 11:19:22 -0700

I have a question regarding connection.createStatement()
which I wonder if someone know how it function.

I am looking/reviewing some customer code and I found
the code below in one place (some code are converted
to clarity more than for exactness):

Connection con = connPool.getConnection();

Statement stmt = conn.createStatement();

conn.setAutoCommit(true);

ResultSet rs = stmt.executeUpdate(...);

Presumption is that the connection from pool could have
auto commit set to false or true since last invocation
(is that correct). The connection pool is keeping the
free connections is a list so the auto commit is
unknown when the connection is picked from the pool
if the JDBC spec doesn't always change it back to
true after commit is some circumstances.

Now to my question, what will happen to the already
created statment above if the call to setAutoCommit(true)
is called after the statement is created? Will the
statment use autocommit from the previous state, which
could be false or will it adopt the new state?

-Kenneth Ljunggren



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: 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)
  • Re: Connection pooling and changed password issue
    ... There is no "clear the pool" or "drop the pool" until ADO.NET 2.0. ... > Hi - so a previously made connection with the old credentials will still ... > "William Vaughn" wrote: ... >>> username/password then the connection pool will be used and the same ...
    (microsoft.public.dotnet.framework.adonet)

Loading