How Can an Application Get Exclusive Access to a Database Using the SQL Toolkit? Primary Software: LabWindows/CVI Add-ons>>Enterprise Connectivity ToolsetPrimary Software Version: 1.1 Primary Software Fixed Version: N/A Secondary Software: N/A
Problem: I have an application that accesses a networked database from multiple computers. I am using the SQL Toolkit with LabWindows/CVI. There is a potential problem where two applications will try to read and or write to the database at the same time. I have tried to use DBSetConnectionAttribute function with ATTR_DB_CONN_MODE set to DB_CONN_MODE_SHARE_EXCLUSIVE or DB_CONN_MODE_SHARE_DENY_NONE. However, when I run the program from two different computers, the database access does not get locked. Solution: You can fix the problem by changing the settings of the database itself, and specifying how it handles an open connection there. You can set it for an exclusive open, not shared open. The menu item for changing the database settings would be something like tools/options/advanced, but it, of course, depends on the database you are using. Then by calling just DBConnect, you can lock the database from other applications. Related Links: Attachments:
Report Date: 01/30/2003 Last Updated: 12/07/2004 Document ID: 2TT9N3SJ |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
