Share this page

# lrd_oci8_to_oci7

Converts an Oracle OCI 8 connection to an Oracle OCI 7 connection.

    LRDRET lrd_oci8_to_oci7( void* mpvLRDDBIHandleSvcCtx, LRD_CONNECTION** mpptConnection, int miDBErrorSeverity );

The function lrd_oci8_to_oci7 converts an existing Oracle OCI 8 connection, mpptConnection. to an Oracle OCI 7 connection. The script will continue by performing both OCI 7 and OCI 8 operations through the OCI 7 connection. This function modifies the existing connection, mpptConnection, and does not create any new connection to the database.

lrd_oci8_to_oci7 will typically be used as a substitute to lrd_open_connection which may open an extra OCI 7 connection itself when preceded by lrd_session_begin (see example). This situation can occur when recording SQL*Plus, Forms or Pro*C applications. Instead of keeping both the OCI 7 and OCI 8 connections open, you enable the existing OCI 8 connection to accept OCI 7 calls by calling lrd_oci8_to_oci7.

## Return Values

See LRD Return Values.

## Parameterization

The following arguments can be parameterized using standard parameterization: mpszUser, mpszPassword, mpszServer, mpszExtConnectStr

## Example

The following example shows how both OCI 8 and OCI 7 functions are recorded within a script. First, lrd_server_attach opens an OCI 8 connection to a server using the OCI 8 service context handle, OraSvc1. The function lrd_open_connection then opens a new connection to deal with the OCI 7 functions that follow. However, lrd_open_connection has now been commented out and lrd_oci8_to_oci7 is substituted to convert the connection, Con1, to be able to handle the OCI 7 calls. Note that the subsequent OCI 8 functions (e.g., lrd_ora8_stmt) are unaffected by the modification of the connection.

    lrd_init(&InitInfo, DBTypeVersion);

    lrd_initialize_db(LRD_DBTYPE_ORACLE, 2, 0);

    lrd_env_init(LRD_DBTYPE_ORACLE, &OraEnv1, 0, 0);

     /* ORA 8 calls */

    lrd_ora8_handle_alloc(OraEnv1, SERVER, &OraSrv1, 0);

    lrd_ora8_handle_alloc(OraEnv1, SVCCTX, &OraSvc1, 0);

    lrd_ora8_handle_alloc(OraEnv1, SESSION, &OraSes1, 0);

    lrd_ora8_handle_alloc(OraEnv1, SESSION, &OraSes2, 0);

    lrd_server_attach(OraSrv1, "rman", -1, 0, 0);

    lrd_ora8_attr_set_from_handle(OraSvc1, SERVER, OraSrv1, 0, 0);

    lrd_ora8_attr_set(OraSes1, USERNAME, "qatest", -1, 0);

    lrd_ora8_attr_set(OraSes1, PASSWORD, lr_unmask("3c0f3f4fcf9b606126ca"), -1, 0);

    lrd_ora8_attr_set_from_handle(OraSvc1, SESSION, OraSes1, 0, 0);

    lrd_session_begin(OraSvc1, OraSes1, 1, 0, 0);

     /* lrd_open_connection call has been commented out:-

     lrd_open_connection(&Con1, LRD_DBTYPE_ORACLE, "qatest", "qatest", "rman", "", 0, 0, 0); */

    lrd_oci8_to_oci7(OraSvc1, &Con1, 0);

    /* ORA 7 functions */

    lrd_open_cursor(&Csr1, Con1, 0);

    lrd_stmt(Csr1, "SELECT USER FROM DUAL", -1, 0, 1, 0);

    lrd_bind_cols(Csr1, BCInfo_D2, 0);

    lrd_exec(Csr1, 0, 0, 0, 0, 0);

    lrd_fetch(Csr1, 1, 1, 0, PrintRow2, 0);

    GRID(2);

    lrd_close_cursor(&Csr1, 0);

     /* ORA 8 functions */

    lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm1, 0);

    lrd_ora8_stmt(OraStm1, "BEGIN DBMS_OUTPUT.DISABLE; END;", 1, 0, 0);

    lrd_ora8_exec(OraSvc1, OraStm1, 1, 0, &uliRowsProcessed, 0, 0, 0, 0, 0);

    lrd_handle_free(&OraStm1, 0);

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