DBNewConnection

LabWindows/CVI SQL Toolkit 2.3 Help

Edition Date: August 2015

Part Number: 370502D-01

»View Product Info
Download Help (Windows Only)

int DBNewConnection (void);

Purpose

Creates an unopened connection. Unlike DBConnect, DBNewConnection, in conjunction with DBOpenConnection, allows you to set connection attributes before opening the connection.

Note Note  If your program is multithreaded, you must call DBInit before calling DBConnect or DBNewConnection.

Example

hdbc = DBNewConnection();

resCode = DBSetConnectionAttribute (hdbc,

ATTR_DB_CONN_CONNECTION_STRING, "Data Source=DatabaseDSN");

resCode = DBSetConnectionAttribute (hdbc,

ATTR_DB_CONN_CONNECTION_TIMEOUT, 100);

resCode = DBSetConnectionAttribute (hdbc,

ATTR_DB_CONN_ISOLATION_LEVEL, DB_ISOLATION_LEVEL_SERIALIZABLE);

resCode = DBOpenConnection (hdbc);

...

resCode = DBCloseConnection (hdbc);

resCode = DBDiscardConnection (hdbc);

Parameters

None.

Return Value

Name Type Description
connectionHandle int Handle to the database connection that identifies the connection and is a parameter to other functions. If the handle is less than or equal to 0, the connection could not be opened.

WAS THIS ARTICLE HELPFUL?

Not Helpful