DB_Connect Function

Action

Establishes a connection to a database system and returns a handle to that system. This allows you to submit SQL statements to the database for execution.

Include file

DBAPI.bdh

Syntax

DB_Connect(in sConnectStr: string): number;

Return value

Handle to a database connection

Parameter Description
sConnectStr

A connection string identifying the database system and any additional logon information required by your driver. The connection string has the form:

"dsn=data source name;uid=user name;pwd=user password"

where data source name is the name you specified when you generated the ODBC.INI file during the installation of your ODBC driver, and user name is the User ID and password.

You can issue successive calls to DB_Connect to open simultaneous connections to different database systems, or simultaneous connections to the same database system (if supported by that database system). Use DB_Disconnect to close the connection and release the resources.

Example

// To connect to SQL Server:

hDBC := DB_Connect("dsn=qa_sql_server;uid=u1;pwd=u1");

Sample scripts

DBApi01.bdf, Trans.bdf, MutexLogin.bdf