Q: setAutoCommit after connection.createStatement()
From: Ken (cayel_at_tjohoo.se)
Date: 10/13/03
- Next message: Bob X: "Re: Embedded Java database recommendations"
- Previous message: Max: "Java EE 1.4"
- Next in thread: Joseph Weinstein: "Re: Q: setAutoCommit after connection.createStatement()"
- Reply: Joseph Weinstein: "Re: Q: setAutoCommit after connection.createStatement()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Bob X: "Re: Embedded Java database recommendations"
- Previous message: Max: "Java EE 1.4"
- Next in thread: Joseph Weinstein: "Re: Q: setAutoCommit after connection.createStatement()"
- Reply: Joseph Weinstein: "Re: Q: setAutoCommit after connection.createStatement()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|