2.2.8 External Connections
A workbook often pulls in data from external data sources, such as a database or an OLAP cube. An external connection represents a link between a workbook and a particular external data source. It contains properties about the way that the application establishes the connection to the data source and retrieves the data, such as the type of data provider (OLE DB, ODBC, and so on), a server name, security information, and a command to execute on the server. In addition, the external connection contains details about the way the connection is used in the workbook, such as how often to refresh the data.
A data connection object contains external connection information for an external data source that a workbook uses. Data connection objects are independent of the constructs in the workbook that display data, such as tables or PivotTables (section 2.2.5).
A connection definition can be established in an external connection file for easier sharing and reuse, but this overview describes the representation for external data connections that are directly embedded within a workbook file. This embedded representation is required whenever external data is used, and ensures portability of the document and continued operation of the external query in the most cases.
An external connection is specified by a combination of the records defined in DBQUERY_WORKBOOK (section 2.1.7.20.3), DBQUERY_WORKSHEET (section 2.1.7.20.5), DBQUERYEXT (section 2.1.7.20.5) and SXADDLDBQUERY (section 2.1.7.20.6), and the DConn record (section 2.4.84).
If an external connection is not used by any workbook object, it is represented only by a DConn record (section 2.4.84) and the fStandAlone field of the DConn record (section 2.4.84) is set to 1.