The mi_server_reconnect() function

The mi_server_reconnect() function re-establishes a dropped connection.

Syntax

mi_integer mi_server_reconnect(conn)
   MI_CONNECTION *conn;
conn
A pointer to a connection descriptor established by a previous call to mi_open() or mi_server_connect().
Valid in client LIBMI application? Valid in user-defined routine?
Yes No

Usage

The mi_server_reconnect() re-establishes a connection to the database server and database that the connection descriptor, conn, identifies. Use mi_server_reconnect() when the client connection is dropped but the connection descriptor still remains. For example, a callback function that handles the MI_LIB_DROPCONN client-library event can use the mi_server_reconnect() function.

All resources in the session context that failed, such as memory and save sets, are preserved and do not need to be rebuilt. However, any transactions that were in progress when the connection failed are no longer valid, so it is the responsibility of the application to purge invalid rows out of save sets.

You cannot reconnect to a database server to which you are already connected.

Return values

MI_OK
The function was successful.
MI_ERROR
The function was not successful.