Highlighted
Absent Member.
Absent Member.
613 views

exec sql begin tran and autocommit

Jump to solution

Hi,

I'm running some programs in exec sql autocommit mode which I have as a compiler option (Windows VC 2.3.2 on VS 15) with MySQl.

For a short section I want to run in a transaction and commit at the end.

What is the right combination of exec sql statements to achieve this i.e.

(1) running in autocommit, quite a few updates done, interacting with users via dialog system etc.

(2) now want to run a few updates as a transaction and only commit at the end

(3) then return to autocommit

In my testing, it seems to work if I exec sql begin tran immediately after the connect but if quite a lot has happened in the interim it just seems to commit and ignore my begin tran.

Any thoughts?

Thanks a lot,

Linden

 

 

 

Linden Rowland - IT Consultant
Owner/Developer, www.SchoolReportWriter.com
IT Consultant to Tindle Newspaper Group

0 Likes
1 Solution

Accepted Solutions
Absent Member.
Absent Member.

Answered my own question... Realised I'm using the MySQL 'MyISAM' engine on some tables and that doesn't support transactions; it just ignores and auto commits. I've switched key tables to MySQL's default, 'InnoDB' engine and the transactions are working fine.

Linden Rowland - IT Consultant
Owner/Developer, www.SchoolReportWriter.com
IT Consultant to Tindle Newspaper Group

View solution in original post

0 Likes
1 Reply
Absent Member.
Absent Member.

Answered my own question... Realised I'm using the MySQL 'MyISAM' engine on some tables and that doesn't support transactions; it just ignores and auto commits. I've switched key tables to MySQL's default, 'InnoDB' engine and the transactions are working fine.

Linden Rowland - IT Consultant
Owner/Developer, www.SchoolReportWriter.com
IT Consultant to Tindle Newspaper Group

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.