Next Previous Up Top Contents Index

1.2 Connecting to a database

1.2.6 Connecting and disconnecting

The SQL-ODBC library provides DBMS-independent functions to connect to and disconnect from databases. Connecting to a database establishes a context (an instance of <connection>) in which SQL statements may be executed within an application. You can make connections by calling the connect function on a DBMS-specific instance of <database> and <user>.

An application can connect to multiple databases served by a DBMS if the DBMS supports the feature. Multiple-connection support can be determined by calling the multiple-connections? function on the DBMS object.

Keeping connections open requires system resources. An application can disconnect from connections that it no longer needs in order to reduce its use of system resources. When the application terminates, the SQL-ODBC library disconnects all open connections. If a connection is not explicitly terminated using the disconnect generic function, and a client application has no references to it, the connection is terminated when the garbage collector notices that the object can be reclaimed. After a connection has been disconnected, the <connection> object cannot be reused, and so references to it should be dropped.

connect
connections
default-connection
disconnect
disconnect-all
with-connection

OLE, COM, ActiveX and DBMS Reference - 31 MAR 2000

Next Previous Up Top Contents Index