[Mono-dev] More ODBC questions: AutoCommit and BeginTransaction

Amc Gmail amc1999 at gmail.com
Fri Sep 21 16:17:37 EDT 2007


Hi, Mads,

it seems to be you are right and i am also getting ugly transaction
state errors from db2 odbc with mono. i wrote quick dirty patch :) to
fix OdbcTransaction.cs and it would be great if you can try it (diff
and svn diff attached, use any for your convenience). unfortunately i
can't even compile it before mid-october and so sorry (in advance) if
that code has any bugs.

i hope it would help :)
-- amc


On 9/21/07, Mads Bondo Dydensborg <mbd at dbc.dk> wrote:
> mandag 03 September 2007 skrev Mads Bondo Dydensborg:
> Hi again.
>
> I still can not resolve this question. But I did discover, that there is no
> public way to change the autocommit mode through the mono stack, meaning,
> that if one uses a transaction, one can never return to autocommit mode.
>
> Is this really the right way to do things?
>
> Regards
>
> Mads
>
>
> > Hi all
> >
> > I am not posting a bug, because I have no idea if this is a bug. Perhaps
> this
> > is the intended way:
> >
> > For ODBC connections, the default mode is "autocommit": Each statement is
> > followed by an commit, done by the driver, client side. This can be disabled
> > programmatically.
> >
> > When an ODBC transaction is created in mono, we change the attributes in
> > OdbcTransaction.cs:
> >
> >      51                 internal OdbcTransaction(OdbcConnection conn,
> > IsolationLevel isolationlevel)
> >      52                 {
> >      53                         // Set Auto-commit (102) to false
> >      54                         OdbcReturn
> > ret=libodbc.SQLSetConnectAttr(conn.hDbc, OdbcConnectionAttribute.AutoCommit,
> > IntPtr.Zero, 0);
> >
> > We have to do that, obviously, but my question is wheter mono should
> > reestablish the state of autocommit upon completion of the transaction?
> > Currently it does not, but is this to be expected? I think, from my reading
> > that it is, but would very much like a confirmation.
> >
> > Currently I am not able to check out the behavoiur using MS .NET.
> >
> > Thanks,
> >
> > Regards
> >
> > Mads
> >
> > --
> > Med venlig hilsen/Regards
> >
> > Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo
> Dydensborg
> > Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77
> 34
> >
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >
> >
>
>
>
> --
> Med venlig hilsen/Regards
>
> Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo Dydensborg
> Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77 34
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OdbcTransaction_auto_commit.svn_diff
Type: application/octet-stream
Size: 2177 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070921/bdcca7f4/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OdbcTransaction_auto_commit.diff
Type: application/octet-stream
Size: 1064 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070921/bdcca7f4/attachment-0001.obj 


More information about the Mono-devel-list mailing list