On 17.05.2017 16:36, ksubramanian@paycommerce.com wrote:
The reason for disable the auto-commit is to mimic more or less similar to oracle behaviour. Because our existing system was in oracle. Just asking out of curiosity – why we enable auto-commit by default in Maria DB. I felt that it wont give control on how we maintain the transaction.
My guess is that it is because it is how most people expect it to behave. I certainly do, and I'm not alone. For example, JDBC mandates autocommit=on after connection.
From http://docs.oracle.com/javase/tutorial/jdbc/basics/transactions.html
"When a connection is created, it is in auto-commit mode. This means that each individual SQL statement is treated as a transaction and is automatically committed right after it is executed. (To be more precise, the default is for a SQL statement to be committed when it is completed, not when it is executed. A statement is completed when all of its result sets and update counts have been retrieved. In almost all cases, however, a statement is completed, and therefore committed, right after it is executed.) The way to allow two or more statements to be grouped into a transaction is to disable the auto-commit mode. This is demonstrated in the following code, where con is an active connection: con.setAutoCommit(false); " Another example, SQLServer defaults to autocommit mode as well https://msdn.microsoft.com/en-us/library/ms971557.aspx Those who never used SQLServer,MySQL, or JDBC may have different expectations of the default.
Can anyone provide some reasons for why we need to keep the auto-commit enabled at server level.
Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
*From: *Vladislav Vaintroub <mailto:vvaintroub@gmail.com> *Sent: *17 May 2017 18:08 *To: *ksubramanian@paycommerce.com <mailto:ksubramanian@paycommerce.com>; Maria Discuss <mailto:maria-discuss@lists.launchpad.net> *Subject: *Re: [Maria-discuss] Connector Net Question
On 17.05.2017 11:26, ksubramanian@paycommerce.com <mailto:ksubramanian@paycommerce.com> wrote:
All,
We have set auto-commit=false at server level.
But our .Net developers want to enable this auto-commit as true (default behaviour) that I hesitant to do that. Is there any connector (driver) properties that we can set at connection level for auto-commit. I know in JDBC driver, we have the properties that we can set at driver level when we establish connection to DB. But for connector/Net I am trying to find, couldn’t locate one. I noticed auto-enlist sett to true or false, not sure whether this will mimic the auto-commit functionality in a given connection.
Can anyone using .Net and MariaDB combination help me to share your thought on this.
Out of curiosity, what is the reason for you to use the non-default behavior (global auto-commit=false)?
As far as I know, you cannot set arbitrary session variable automatically with C/NET, and there is no property for autocommit. Thus this would need to be done in code, just after connecting, e.g command.executeNonQuery("set @@autocommit=1")
Regards,
Karthick
Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
_______________________________________________
Mailing list:https://launchpad.net/~maria-discuss <https://launchpad.net/%7Emaria-discuss>
Post to :maria-discuss@lists.launchpad.net <mailto:maria-discuss@lists.launchpad.net>
Unsubscribe :https://launchpad.net/~maria-discuss <https://launchpad.net/%7Emaria-discuss>
More help :https://help.launchpad.net/ListHelp