Share this page

# lrd_alloc_connection

Allocates a connection structure.

    LRDRET lrd_alloc_connection( LRD_CONNECTION **mpptConnection, unsigned int muiDBType, LRD_CONTEXT *mptContext, long mliOption, int miDBErrorSeverity );

mpptConnection | A pointer to a pointer to an LRD_CONNECTION structure.
muiDBType | The target database type.
mptContext | A pointer to an LRD_CONTEXT structure. (ODBC and CtLib only).
mliOption | One of the Allocate Connection options (NULL).
miDBErrorSeverity | The Error Severity Levels of a failure in a database routine.

The lrd_alloc_connection function allocates an LRD_CONNECTION structure. The structure is valid until it is released with lrd_free_connection.

For more details refer to the Function Header File lrd.h in the include directory.

## Return Values

See LRD Return Values.

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

In the following example, the lrd_alloc_connection function allocates a connection to an ODBC database after initializing the environment with lrd_init (in the vuser_init section).

Copy code

    lrd_init(&InitInfo, DBTypeVersion);
    lrd_open_context(&Ctx1, LRD_DBTYPE_ODBC, 0, 0, 0);
    lrd_alloc_connection(&Con1, LRD_DBTYPE_ODBC, Ctx1, 0 /*Unused*/, 0);
    lrd_db_option(Con1, OT_ODBC_TXN_READ_COMMITTED, 0, 0);
    lrd_db_option(Con1, OT_ODBC_AUTOCOMMIT, "OFF", 0);
    lrd_open_connection(&Con1, LRD_TYPE_ODBC, "", "", "flight32_quadbase", "", Ctx1, 0, 0);
    lrd_open_cursor(&Csr1, Con1, 0);

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: