Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Manages the connection with the data source.
class CDataConnection
Members
Methods
Constructor. Instantiates and initializes a CDataConnection object. |
|
Creates a copy of an existing data connection. |
|
Opens a connection to a data source using an initialization string. |
|
Opens a new session on the current connection. |
Operators
Determines whether the current session is open or not. |
|
Determines whether the current session is open or not. |
|
Returns a reference to the contained CDataSource object. |
|
Returns a pointer to the contained CDataSource object. |
|
Returns a reference to the contained CSession object. |
|
Returns a pointer to the contained CSession object. |
Remarks
CDataConnection is a useful class for creating clients because it encapsulates necessary objects (data source and session) and some of the work you need to do when connecting to a data source
Without CDataConnection, you have to create a CDataSource object, call its OpenFromInitializationString method, then create an instance of a CSession object, call its Open method, then create a CCommand object and call its Open* methods.
With CDataConnection, you only need to create a connection object, pass it an initialization string, then use that connection to open commands. If you plan on using your connection to the database repeatedly, it is a good idea to keep the connection open, and CDataConnection provides a convenient way to do that.
Note
If you are creating a database application that needs to handle multiple sessions, you will need to use OpenNewSession.
Requirements
Header: atldbcli.h