Re: Manual commit ODBC transactions?
Posted in 2004
--0__=08BBE416DFC79EE78f9e8a93df938690918c08BBE416DFC79EE7 Content-type: multipart/alternative; Boundary="1__=08BBE416DFC79EE78f9e8a93df938690918c08BBE416DFC79EE7" --1__=08BBE416DFC79EE78f9e8a93df938690918c08BBE416DFC79EE7 Content-type: text/plain; charset=US-ASCII Hi Rob, I am not very familiar with ODBCExpress. However, I would like to give you an idea about how you can do the same using small ODBC application. First of all you have to make sure what type of database you are dealing with i.e. logging, bufferd logging or ANSI. For more info pl. refer your Server Administrator's Guide. http://publib.boulder.ibm.com/epubs/pdf/ct1ucna.pdf You might also want to refer IBM Informix ODBC Programmers's manual, see page #56-57. http://publib.boulder.ibm.com/epubs/pdf/ct1ufna.pdf For example lets assume you are working with ANSI database, your ODBC C app would look like as follows to perform the manual commit. Create your DSN with default settings. That means let the "Auto Commit Optimization" check box be checked. 1. Allocate required handles. 2. SQLConenct/SQLDriverConnect ( ...."connect with ANSI database" .....); 3. Set SQL_ATTR_AUTOCOMMIT attribute to SQL_AUTOCOMMIT_OFF using SQLSetConnectAttr. 4. Allocate statement handle. 5. Execute "Begin work;" using SQLExecDirect(); // This will start the transaction. 6. Do whatever you want ....select, insert, update etc. 7. Execute SQLEndTran either with SQL_ROLLBACK or SQL_COMMIT. // This will end the transaction after performing the necessary operation. 8. Do necessary cleanup. I am hoping if you are connecting to ANSI database then even using ODBCExpress you should be able to run it successfully, if you are sure that the above steps are being taken care under the cover. HTH Thanks -Shesh Rob <nospam@nowhere.c To: informix-list@iiug.org om> cc: Sent by: Subject: Manual commit ODBC transactions? owner-informix-li st@iiug.org 04/27/2004 07:44 AM Please respond to Rob Hello, When attempting a manual commit, I receive a "Driver not capable" error message. Is it possible to use manual transactions with Informix v9.4 and ODBC driver v3.82 ? I tried the ODBC advanced setup option "Auto commit optimization" both ways with the same result. I am using ODBCExpress with StartTransact(), Commit(), and EndTransact() sequence to manually manage transactions. This works great with MSSQL. Is there a better ODBC driver available? Rob. --1__=08BBE416DFC79EE78f9e8a93df938690918c08BBE416DFC79EE7 Content-type: text/html; charset=US-ASCII Content-Disposition: inline <html><body> <p>Hi Rob,<br> <br> I am not very familiar with ODBCExpress. However, I would like to give you an idea about how you can do the same using small ODBC application.<br> <br> First of all you have to make sure what type of database you are dealing with i.e. logging, bufferd logging or ANSI. For more info pl. refer your<br> Server Administrator's Guide. <a href="http://publib.boulder.ibm.com/epubs/pdf/ct1ucna.pdf">http://publib.boulder.ibm.com/epubs/pdf/ct1ucna.pdf</a><br> <br> You might also want to refer IBM Informix ODBC Programmers's manual, see page #56-57. <a href="http://publib.boulder.ibm.com/epubs/pdf/ct1ufna.pdf">http://publib.boulder.ibm.com/epubs/pdf/ct1ufna.pdf</a><br> <br> For example lets assume you are working with ANSI database, your ODBC C app would look like as follows to perform the manual commit.<br> <br> Create your DSN with default settings. That means let the "Auto Commit Optimization" check box be checked.<br> <br> 1. Allocate required handles.<br> 2. SQLConenct/SQLDriverConnect ( ...."connect with ANSI database" .....);<br> 3. Set SQL_ATTR_AUTOCOMMIT attribute to SQL_AUTOCOMMIT_OFF using SQLSetConnectAttr.<br> 4. Allocate statement handle.<br> 5. Execute "Begin work;" using SQLExecDirect(); // This will start the transaction.<br> 6. Do whatever you want ....select, insert, update etc.<br> 7. Execute SQLEndTran either with SQL_ROLLBACK or SQL_COMMIT. // This will end the transaction after performing the necessary operation.<br> 8. Do necessary cleanup.<br> <br> I am hoping if you are connecting to ANSI database then even using ODBCExpress you should be able to run it successfully, if you are sure<br> that the above steps are being taken care under the cover.<br> <br> HTH<br> <br> Thanks<br> -Shesh<br> <br> <img src="cid:10__=08BBE416DFC79EE78f9e8a93df938@us.ibm.com" width="16" height="16" alt="Inactive hide details for Rob <nospam@nowhere.com>">Rob <nospam@nowhere.com><br> <br> <br> <table V5DOTBL=true width="100%" border="0" cellspacing="0" cellpadding="0"> <tr valign="top"><td width="1%"><img src="cid:20__=08BBE416DFC79EE78f9e8a93df938@us.ibm.com" border="0" height="1" width="72" alt=""><br> </td><td style="background-image:url(cid:30__=08BBE416DFC79EE78f9e8a93df938@us.ibm.com); background-repeat: no-repeat; " width="1%"><img src="cid:20__=08BBE416DFC79EE78f9e8a93df938@us.ibm.com" border="0" height="1" width="225" alt=""><br> <ul> <ul> <ul> <ul><b><font size="2">Rob <nospam@nowhere.com></font></b><br> <font size="2">Sent by: owner-informix-list@iiug.org</font> <p><font size="2">04/27/2004 07:44 AM</font><br> <font size="2">Please respond to Rob</font></ul> </ul> </ul> </ul> </td><td width="100%"><img src="cid:20__=08BBE416DFC79EE78f9e8a93df938@us.ibm.com" border="0" height="1" width="1" alt=""><br> <font size="1" face="Arial"> </font><br> <font size="2"> To: </font><font size="2">informix-list@iiug.org</font><br> <font size="2"> cc: </font><br> <font size="2"> Subject: </font><font size="2">Manual commit ODBC transactions?</font></td></tr> </table> <br> <br> <font face="Courier New"><br> Hello,<br> <br> When attempting a manual commit, I receive a "Driver not capable" error <br> message.<br> <br> Is it possible to use manual transactions with Informix v9.4 and ODBC <br> driver v3.82 ? I tried the ODBC advanced setup option "Auto commit <br> optimization" both ways with the same result.<br> <br> I am using ODBCExpress with StartTransact(), Commit(), and EndTransact() <br> sequence to manually manage transactions. This works great with MSSQL.<br> <br> Is there a better ODBC driver available?<br> <br> Rob.<br> </font> </body></html> --1__=08BBE416DFC79EE78f9e8a93df938690918c08BBE416DFC79EE7-- --0__=08BBE41