Skip to Content.
Sympa Menu

freetds - FreeTDS JDBC : Statements and transaction

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Shinji Suzuki" <shinji-s AT hat.hi-ho.ne.jp>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: FreeTDS JDBC : Statements and transaction
  • Date: Thu, 9 Aug 2001 01:13:21 -0400


Hi.

I've noticed that using FreeTDS, Statements do not share transaction
state even if they are from the same Connection. An example is;
(1) createStatement from cx (stA = cx.createStatement())
(2) createStatement from cx (stB = cx.createStatement())
(3) set autocommit on cx (cx.setAutoCommit(true))
(4) execute a sql command through stA (e.g. select * from intranet..cache)
that will start transaction.
(5) 'select @@trancount' through stA returns 1
(6) but 'select @@trancount' through stB returns 0

This implies that commands that are issued through a
statement will be commited when cx.commit() is called only
if the statement is left open until that point.

My expectation is that commiting through a statement should
affect all sql commands issued through other statements
as long as the statements are created from the same connetion
object. Am I right? If so, how should the source
code need to be restructured? Fom cursory looking I feel that
allocating TDS object per statement is the source of the problem.
(Currenly, I hacked the FreeTDS JDBC code to create only one
Statement object per connection and to return the same Statement
object for every createStatement() call so that my application
built for use with BEA's driver can work with FreeTDS.)

-shinji




Archive powered by MHonArc 2.6.24.

Top of Page