Previous PageNext Page

9.3 Connection Object

A Connection object represents an open connection to a data source.
 

Collections

Errors
 
Contains all stored Error objects which pertain to an ADO operation.
 
Properties
 
All Property objects for a specific instance of a Connection object. This collection is not currently supported on Unix.
 

Methods

BeginTrans
 
Begins a new database transaction within a Connection object.
 
Close
 
Closes an open Connection object and any dependent objects.
 
CommitTrans
 
Saves any pending changes and ends the current transaction. It may also start a new transaction.
 
Execute
 
Executes the specified query, SQL statement, stored procedure, or provider-specified text.
 
Open
 
Opens a connection to a data source.
 
OpenSchema
 
Obtains database schema information from the provider. This method is not currently supported on UNIX.
 
RollbackTrans
 
Cancels any changes made during the current transaction and ends the transaction. It may also start a new transaction.
 

Properties

Attributes
 
One or more characteristics of an object.
 
CommandTimeout
 
How long to wait while executing a command before terminating the command and issuing and error.
 
ConnectionString
 
Contains the information used to establish a connection to a data source.
 
ConnectionTimeout
 
How long to wait while establishing a connection before terminating the attempt and issuing and error.
 
CursorLocation
 
The location of the cursor engine in a Recordset.
 
DefaultDatabase
 
The default database for the Connection object.
 
IsolationLevel
 
The level of isolation for the Connection object.
 
Mode
 
The available permissions for modifying data in a Connection object.
 
Provider
 
The name of a provider for a Connection object. This property is not available on UNIX.
 
State
 
Describes the current state of the Connection object.
 
Version
 
The ADO version number.
 

Remarks

A Connection object represents a session with a data source. In the case of client/server database system, it may represent an actual network connection to the server. Depending on the functionality of the provider, some collections, properties, and methods of the Connection object may not be available.
 
Use the collections, methods, and properties of a Connection object for:
 
  • configuring the connection before opening it with the ConnectionString, CommandTimeout, and Mode properties.
  • setting the CursorLocation property to invoke the Client Cursor Provider, which supports batch updates. Batch updates are not currently supported on UNIX.
  • setting the default database for the connection with the DefaultDatabase property.
  • setting the level of isolation for the transactions opened on the connection with the IsolationLevel property. Transactions are not currently supported on UNIX.
  • specifying an OLE DB provider with the Provider property.
  • establishing and breaking the physical connection to the data source with the Open and Close methods.
  • executing a command on the connection with the Execute method and configure the execution with the CommandTimeout property.
  • managing transactions on the open connection, including nested transactions if the provider supports them, with the BeginTrans, CommitTrans, and RollbackTrans methods and the Attributes property. The transaction methods are not currently supported on UNIX.
  • examining errors returned from the data source with the Errors collection.
  • reading the version from the ADO implementation in use with the Version property.
  • obtaining schema information about your database with the OpenSchema method.

Note:

To execute a query without using a Command object, pass a query string to the Execute method of a Connection object. However, a Command object is required when you want to retain the command text and re-execute it, or use query parameters.


Copyright © 2000 Chili!Soft

Previous PageTop Of PageNext Page