Generated by GPT-5-mini| ADODB.Connection | |
|---|---|
| Name | ADODB.Connection |
| Developer | Microsoft |
| Released | 1996 |
| Operating system | Windows NT, Windows 95, Windows 98, Windows 2000, Windows XP, Windows Server 2003, Windows 7, Windows 10 |
| Programming language | Visual Basic (programming language), VBScript, JScript |
| Genre | Database connectivity, Data Access |
| License | Proprietary |
ADODB.Connection ADODB.Connection is a component of Microsoft's ActiveX Data Objects (ADO) that provides a programmable interface for establishing and managing connections to data sources. It serves as a bridge between client code and data providers such as OLE DB and ODBC, enabling applications written in Visual Basic (programming language), VBScript, ASP.NET and COM-based environments to execute commands, manage transactions, and stream results. Historically tied to technologies used in Windows-centric enterprise applications and web servers like Internet Information Services, ADODB.Connection remains relevant in legacy systems, data migration, and interoperability scenarios.
ADODB.Connection is part of the ADO object model introduced alongside technologies such as OLE DB and Microsoft Data Access Components. It encapsulates the details of opening sessions with drivers, negotiating provider options, and exposing runtime state through properties and events. Implementations interact with vendors' providers such as Microsoft SQL Server, Oracle, IBM DB2, and third-party drivers that conform to the OLE DB standard. The Connection object cooperates with related ADO objects—Command, Recordset, Parameter—to facilitate structured data access in environments including Microsoft Excel, Microsoft Access, and Active Server Pages.
A Connection object is instantiated in environments that support ActiveX or COM instantiation patterns. Typical creation occurs in Visual Basic (programming language), VBScript, or script hosts running on Windows Server platforms. Opening a connection requires a connection string that names a provider, server, database, and optional credentials; common targets include SQL Server 2000, SQL Server 2005, Oracle Database, and MySQL. Connection strings often reference providers like Microsoft OLE DB Provider for SQL Server or ODBC drivers for PostgreSQL, and may include parameters tied to Kerberos or NTLM for integrated authentication. When operating against cloud-era platforms, teams historically adapted ADODB.Connection to authenticate with services such as Azure SQL Database via compatible providers.
ADODB.Connection exposes properties that reflect and influence runtime behavior: Provider, ConnectionString, State, CursorLocation, CommandTimeout, and IsolationLevel among others. Methods include Open, Close, Execute, BeginTrans, CommitTrans, RollbackTrans, and Execute with adCmdText flags to run statements or stored procedures on systems like Microsoft SQL Server, Oracle Database, Sybase ASE, and IBM Informix. The Execute method returns Recordset objects consumable by client code or UI layers such as those in Microsoft Visual Studio projects. The State property maps to enumerations indicating open, closed, connecting, or executing states used in conjunction with event handling for responsive applications.
ADODB.Connection provides transaction control via BeginTrans, CommitTrans, and RollbackTrans, enabling coordinated changes across multiple commands and Recordset updates. Transaction isolation levels can be set to match semantics expected by database systems like Microsoft SQL Server, Oracle Database, and DB2 to balance concurrency and consistency. In multi-database scenarios spanning heterogeneous providers—such as coordinated updates across SQL Server and Oracle—developers historically relied on Microsoft Distributed Transaction Coordinator (MS DTC) to manage two-phase commits. Integration with MS DTC and support for enlistment are important when interacting with enterprise middleware such as COM+ or Microsoft Message Queuing.
ADODB.Connection raises errors that surface through the ADO Errors collection and standard COM error mechanisms; these are commonly inspected in application code to diagnose provider-specific failures against backends like SQL Server, Oracle, or PostgreSQL. Event-driven environments can hook Connection events—such as InfoMessage or ExecuteComplete—to implement logging, retry logic, or progress feedback when interacting with systems like Internet Information Services or client applications built with Visual Basic (programming language). Exception handling patterns often combine ADO Errors parsing with structured error reporting tools used in enterprises such as Microsoft System Center products or legacy monitoring suites.
Authentication with ADODB.Connection may use username/password credentials, integrated Windows authentication (NTLM/Kerberos), or provider-specific mechanisms supported by databases like Azure SQL Database and Oracle Database. Connection strings must be treated as sensitive artifacts; best practices borrowed from secure operations in organizations such as National Institute of Standards and Technology recommend minimizing plaintext credentials, using impersonation models from Windows Server and encrypting connections with TLS as supported by providers. When used in multi-tenant or cloud scenarios—paralleling practices in Amazon Web Services or Microsoft Azure architectures—proper credential management, least privilege access to databases, and secure storage (e.g., Azure Key Vault) are crucial.
Common usage patterns include executing parameterized commands against Microsoft SQL Server using ADO Command objects with Recordset results for data-binding in Microsoft Access or Visual Basic (programming language) forms. Scripts in Active Server Pages historically instantiated ADODB.Connection to serve dynamic pages driven by SQL Server 2000 or MySQL. For migration, teams often wrap ADODB.Connection calls to abstract provider differences when porting applications to ADO.NET in Microsoft .NET Framework or to modern ORMs used in Entity Framework projects. Batch processing and ETL tasks in legacy toolchains integrate ADODB.Connection with automation platforms like Windows Task Scheduler or enterprise schedulers deployed in data centers run by institutions such as IBM or Oracle Corporation.
Category:Microsoft software