Transactions in ODBC
来源:互联网 发布:网络系统集成的概念 编辑:程序博客网 时间:2024/05/29 04:28
Transactions in ODBC are managed at the connection level. When an application completes a transaction, it commits or rolls back all work completed through all statement handles on that connection. To commit or roll back a transaction, applications should call SQLEndTran instead of submitting a COMMIT or ROLLBACK statement.
An application calls SQLSetConnectAttr to switch between the two ODBC modes of managing transactions:
Autocommit mode
Each statement is automatically committed when it is completed successfully. When you run in autocommit mode, no other transaction management functions are required.
Manual-commit mode
All executed statements are included in the same transaction until it is specifically stopped by calling SQLEndTran.
Autocommit mode is the default transaction mode for ODBC. When a connection is made, it is in autocommit mode until SQLSetConnectAttr is called to switch to manual-commit mode by setting autocommit mode off. When an application turns autocommit off, the next statement sent to the database starts a transaction. The transaction then remains in effect until the application calls SQLEndTran with either the SQL_COMMIT or SQL_ROLLBACK options. The command sent to the database after SQLEndTran starts the next transaction.
If an application switches from manual-commit to autocommit mode, the driver commits any transactions currently open on the connection.
ODBC applications should not use Transact-SQL transaction statements such as BEGIN TRANSACTION, COMMIT TRANSACTION, or ROLLBACK TRANSACTION because this can cause indeterminate behavior in the driver.An ODBC application should run in autocommit mode and not use any transaction management functions or statements, or run in manual-commit mode and use the ODBC SQLEndTran function to either commit or roll back transactions.
SQLEndTran Function
SQLRETURN SQLEndTran( SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT CompletionType);
SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, SQL_INVALID_HANDLE, or SQL_STILL_EXECUTING.
reference:
http://msdn.microsoft.com/en-us/library/ms131281.aspx
http://msdn.microsoft.com/zh-cn/library/ms716544.aspx
- Transactions in ODBC
- Savepoints In Transactions
- In-Doubt Transactions
- Transactions
- [OnJava] Wire Hibernate Transactions in Spring
- Getting Ledger transactions in Ax 2012
- ODBC in Win7
- How to add a DELAY in applying transactions in GoldenGate?
- ODBC error 00000 in SQLConnect:
- Using ODBC in the core
- Protecting Your Data Integrity with Transactions in ADO.NET
- Distributed transactions in Spring, with and without XA
- Running Distributed Transactions in RAC without DTP service
- Spring JTA multiple resource transactions in Tomcat with Atomikos example
- Spring JTA multiple resource transactions in Tomcat with Atomikos example
- Distributed transactions in Spring, with and without XA
- ODBC ~
- ODBC
- apache-tomcat-7.0.*以上版本配置
- C#写日志方法
- 实现新闻管理系统前的项目分析:
- PHP utf-8编码问题,utf8编码,数据库乱码,页面显示输出乱码
- 白骨精给孙悟空的回信
- Transactions in ODBC
- httpd: Could not reliably determine the server's fully qualified domain name, using
- 线程中的wait和notify方法
- 数据库并发操作
- JS操作Cookie
- rrdtool安装
- Outlook 2010 用代码在Outlook explorer中选中一个邮件
- VC MFC GDI 位图旋转算法
- vim 宏的录制和使用