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 other data providers), 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 set of records, as defined in EXTCONNECTION (section 2.1.7.24). The types of records in the collection are specified by the idbtype field of the BrtBeginExtConnection (section 2.4.80) record.
The following record types refer to external connections:
The link between a BrtBeginExtConnection record and the records referring to it is specified by the unique connection identifier. The connection identifier is specified by the dwConnID field in the BrtBeginExtConnection record and in the dwConnID fields in the records that refer to it. If the dwConnID field in one of the referring records is 0, this record does not refer to external data.
It is possible for an external connection to not be used by any workbook object. In this case there is no record referring to it.