The mi_open() function
The mi_open() function establishes a connection to a database server.
Syntax
MI_CONNECTION *mi_open(db_name, user_name, user_passwd)
const char *db_name;
const char *user_name;
const char *user_passwd;
- db_name
- The name of the database to open.
- user_name
- The name of the user account on the server computer.
- user_passwd
- The account password.
Valid in client LIBMI application? | Valid in user-defined routine? |
---|---|
Yes | Yes |
Usage
The mi_open() function obtains a connection descriptor for a connection. This function is a constructor function for a connection descriptor. The DataBlade® API module can pass the new connection descriptor to subsequent routines that require a connection. The mi_open() function also initializes the DataBlade API when this function is the first DataBlade API function in a client LIBMI application or a C UDR.
In a C UDR, do not specify the name of a database or user account to the mi_open() function. If you do not provide the three arguments as NULL-valued pointers, mi_open() fails but does not generate a message.
- The mi_open() argument
- Default value when argument is NULL
- Database name
- None
- User name
- The name of the user login account that is running the executable file
- Password
- The password of the user account that is running the executable file
If the client LIBMI application uses a shared-memory communication, it can establish only one connection per application.
Return values
- An MI_CONNECTION pointer
- A pointer to the connection descriptor for the newly established connection.
- NULL
- The function was not successful.