Establishing a connection

 

After allocating environment and connection handles, and setting any connection attributes, the application is ready to connect to the data source or driver. There are three different subroutines the application can use to do this: f90SQLConnect (Core interface conformance level), f90SQLDriverConnect (Core), and f90SQLBrowseConnect (Level 1). Each of the three is designed to be used in a different scenario.

 

An application can establish only one connection per connection handle. Your application can have several connection handles, each one associated to an active connection, at the same time. Once a connection is dropped (using f90SQLDisconnect) the handle can be associated to a new connection.

 

Some drivers limit the number of active connections they support. An application can call f90SQLGetInfo with the SQL_MAX_DRIVER_CONNECTIONS option to determine how many active connections a particular driver supports.

 

Some drivers have a default data source, to which they connect an application that does not explicitly pass a data source with a connection request. For example, a call to f90SQLConnect in which the argument ServerName is a zero-length string or a null pointer can result in the driver connecting to the default data source. The default data source is driver-defined. This may involve administrative action and may depend on the user.

 

The next sections explain the use of the three subroutines to establish a connection to a driver or data source.