Timeout Ignored Using DB Tools Open Connection VI in LabVIEW

Updated Apr 23, 2023

Reported In

Software

  • LabVIEW
  • LabVIEW Database Connectivity Toolkit

Issue Details

When I try to open a connection to a SQL database server in LabVIEW that is down or not present on the network, the specified timeout is ignored and I get the following error:

Error -2147467259

Exception occured in Microsoft OLE DB Provider for SQL Server:
[ConnectionOpen (Connect()).]SQL Server does not exist or access denied

 

Solution

This error is a low-level design issue in the OLE DB driver which LabVIEW uses to interface with your SQL database. The specified timeout is only evaluated once network connection is established. When the network location isn't present, the timeout is evaluated in the network connection protocol (which you cannot configure in LabVIEW) before returning an error. 

To workaround this: 
  1. First ping the server to verify it's presence
  2. If the location is present, proceed opening the database connection
  3. If the location is not present, move forward with code execution bypassing the database connection portion
See this example for a starting point on pinging the server prior to opening a connection. 

Additional Information

NOTE: This behavior is seen across most Microsoft built databases

LabVIEW uses Microsoft ActiveX Data Objects (ADO) database client technology. ADO, which is built on top of the Object Linking and Embedding Database (OLE DB), is one of several database interface technologies integrated into Microsoft Windows operating systems.

Applications that use ADO, such as LabVIEW, use the OLE DB interfaces indirectly. The OLE DB layer interfaces to databases directly through a specific OLE DB driver for the specified database type. This issue cannot be directly overcome since the issue lies in a OLE DB driver call.