IDAConnection
From RemObjects Software
This is a Data Abstract Architecture entry
Feel free to add your notes to this topic below.
Overview
The IDAConnection interface represents an individual connection to a database. Connections are usually obtained from the TDAConnectionManager component and will be implemented by different classes depending on the database driver you are using. Connection classes for some drivers implement additional interfaces that expose driver- or database-specific functionality, such as IDAADOConnection, IDAInterbaseConnection or IDAOracleConnection.
File
- uDAInterfaces
Hierarchy
- IDABaseConnection
- IDAConnection
Properties
| | | |
|---|---|---|
| Connected | Boolean | Indicates whether the connection object currently has an active link to the database (true) or not (false). Usually, a Data Abstract connection connects to the database when it is created, and is not closed until discarded and eventually removed from the connection pool. However, you can use the Open and Close methods to manually connect or disconnect from the database, if needed. |
| ConnectionString | String | Sets the database connection string that was used to open this connection. The exact content of this string depends on the driver and database you are using, but it will usually contain information such as the database name, user id and password, as well as additional connection parameters. Please refer to the reference for the specific driver for more details. |
| InTransaction | Boolean | Indicates whether the connection is currently inside a transaction (true) or not (false). When inside a transaction, all changes made to the database are not applied to the physical database right away, but will be held until the transaction is commited. Then and only then will all changes be made permanent. Exact transaction behavior (such as transaction isolation) might also depend on the used database back-end setup and the connection parameters. |
| Name | String | Returns a human-readable name for the connection. For connections obtained through a TDAConnectionManager component, this will be the name that the connection was defined under in Schema Modeler. |
| Password | String | Defines the Password that was or will be used to open this connection. This value is usually obtained from the connection string. |
| UserID | String | Holds the User ID that was or will be used to open this connection. This value is usually obtained from the connection string. |
Methods
| | |
|---|---|
| BeginTransaction | Starts a new transaction for the current connection. After this call, all subsequent changes to the database will be isolated in a new transaction and are not applied to the physical database right away. Only when the transaction is commited though a call to CommitTransaction, the changes are made permanent. |
| Close | Closes the physical connection to the database back-end. |
| CommitTransaction | Commits a transaction that was started with a prior call to BeginTransaction. All changes made in the context of the transaction will be permanently applied to the database at this point. The commit will only succeed if all changes can be successfully applied. To discard changes made, instead of persisting them, call RollbackTransaction instead. |
| NewCommand | Returns a new IDASQLCommand implementation that can be used to execute a SQL command on the underlying database. In normal Data Abstract operations, you will not call this method directly, but obtain commands defined in your schema from the TDASchema component to execute them. However, this method provides the ability to easily execute custom SQL code against the database back-end, if the need should arise. |
| NewDataset | Returns a new IDADataset implementation that can be used to retrieve records from the database. In normal Data Abstract operations, you will not call this method directly, but obtain datasets (a.k.a. data tables) defined in your schema from the TDASchema component to retrieve them. However, this method provides the ability to easily execute custom SQL code to select specific data from the database back-end, if the need should arise. |
| Open | Establishes a physical connection to the database back-end, using the specified ConnectionString. |
| RollbackTransaction | Discards a transaction that was started with a prior call to BeginTransaction. All changes made in the context of the transaction will be be discarded and not applied to the physical database. To persist the changes made, instead of discarding them, call CommitTransaction instead. |
See Also
- TDAConnectionManager component
- IDAADOConnection, IDAInterbaseConnection and IDAOracleConnection interfaces.
- Database Drivers
- Lists
Product: RemObjects Data Abstract
Current version: Data Abstract 'Vinci' (5.0)
Lists — Glossary — Features — How To — Drivers — Components — Tools — Samples — Articles — Architecture — Issues
Categories: Text | Data Abstract | Architecture | Interface | Delphi
