DBConnection module

class DBConnection.DBConnection

Bases: ExternalConnection

Represents a database connection in an Excel workbook.

This class extends ExternalConnection and provides properties and methods for managing connections to database sources, including connection strings, commands, and command types. It allows for configuring database-specific connection settings and refresh behavior.

property BackgroundRefresh: bool
property Command: str

Gets or sets the command text for the database connection.

This property contains the SQL query, stored procedure name, or table name that is used to retrieve data from the database.

Returns:

The command text for the database connection.

Return type:

str

property CommandType: OLEDBCommandType

Gets or sets the type of command used in the database connection.

This property specifies how the Command property should be interpreted, such as a SQL statement, table name, or stored procedure name.

Returns:

An enumeration value representing the command type.

Return type:

OLEDBCommandType

property ConnType: ConnectionDataSourceType
property Connection: str

Gets or sets the connection string for the database connection.

This property contains the connection string that specifies how to connect to the database, including server, database name, authentication details, etc.

Returns:

The connection string for the database.

Return type:

str

property ID: str
property KeepAlive: bool
property Name: str
property OdcFile: str
property OnlyUseConnectionFile: bool
property RefreshedVersion: str
property SaveData: bool