Migrating LOGINREC code

In DB-Library, applications use the LOGINREC structure to customize a connection before opening it. In Client-Library applications, use CS_CONNECTION properties to customize a connection before opening it.

To replace DB-Library code that uses the same LOGINREC structure to open several connections, you can use ct_getloginfo and ct_setloginfo, as follows:

  1. Allocate a connection structure with ct_con_alloc.

  2. Customize the connection with calls to ct_con_props.

  3. Open the connection with ct_connect.

  4. For each connection to be opened with the same login properties:

    • Call ct_getloginfo to allocate a CS_LOGINFO structure and copy the original connection‘s login properties into it.

    • Allocate a new connection structure with ct_con_alloc.

    • Call ct_setloginfo to copy login properties from the CS_LOGINFO structure to the new connection structure. After copying the properties, ct_setloginfo deallocates the CS_LOGINFO structure.

    • Customize any non-login properties in the new connection with calls to ct_con_props.

    • Open the new connection with ct_connect.