Connection pooling
- Last UpdatedJul 22, 2024
- 1 minute read
When you request a SQL command or transaction to be run on the aaDBConnection object, an actual physical connection is opened on demand and closed when the command or transaction finishes processing.
The SQLData Script Library uses the DCM common component in regard to connection pooling. When an aaDBConnection object is first created, no attempt is made to achieve a physical connection. The ConnectionState property remains in the Disconnected state. The physical connection is attempted only after a command object is run (a stand-alone command object or a command object that is part of a transaction).
After the first command object that requires a physical connection runs, the physical connection remains open for an unspecified period (depending on loading) and closes automatically after a time.
If a script requires confirmation of a successful physical connection, it must issue some benign SQL statement and then check the ConnectionState property of the connection.
Note: You must call Dispose() on each instance of aaDBConnection.