I have several clients connecting to SQL Server over an untrusted (wireless / gprs) network and performing a large number of small queries and inserts in a few minutes. If the network connection is interrupted during the process, the entire transaction is rolled back and must be restarted. Due to business requirements, the process must be transactional (i.e., Other clients see either a complete set of data from other clients, or do not see it at all).
I would like to be able to detect when the connection is down, and to be able to reconnect to SQL Server and continue the process in the same transaction that was just deleted, and avoid restarting from the very beginning. sp_getbindtoken now, I'm using sp_getbindtoken right after opening the connection, set CommandTimeout to a small value (much less than TCP KeepAlive), and if I get a timeout during ExecuteNonQuery , I will open a new connection to the server and call sp_bindsession with a token from the very beginning of the process . Then I continue the process using a new session connection associated with the transaction of the previous process.
While it works almost perfectly, but according to MSDN , this API is outdated and will be removed in future versions of SQL Server. The question arises: how can I achieve the same results without these two teams? Is there any other way to resume a transaction from a dropped TCP connection?
Edit / Additional Information: The client application runs on Windows CE devices with barcode scanners. I provide both devices and software, so I can freely post anything I need there. The DB is hosted in a secure environment by a third party, and neither I nor the client control it. I have only 50 MB of daily sales data to send. I can use SP to save data, but it still needs to be passed, and one call to SP with one large argument is close to the 0% success rate for the GPRS / EDGE link.
Since the whole solution works in a production environment, I would like to keep the changes to a minimum. An alternative API with the same semantics as sp_bindsession would be ideal.
source share