Skip to Content.
Sympa Menu

freetds - Re: FreeTDS JDBC : Statements and transaction

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Michael Peppler <mpeppler AT peppler.org>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: FreeTDS JDBC : Statements and transaction
  • Date: Thu, 9 Aug 2001 07:27:25 -0700


Shinji Suzuki writes:
> 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

My guess is that the JDBC driver does the same thing I do for
DBD::Sybase to support multiple statement handles on a single
connection handle - namely opening a new physical connection for the
second (and subsequent) statement handles.

It's nearly impossible to coordinate transactions over two separate
connections, so you should probably try to rework your code to avoid
having more than one statement handle open at a time.

Come to think of it - I'd be curious to know how jConnect does this...

Michael
--
Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
mpeppler AT peppler.org - mpeppler AT mbay.net
International Sybase User Group - http://www.isug.com




Archive powered by MHonArc 2.6.24.

Top of Page