Connect to a database.
MCO_RET mco_db_connect(/*IN*/ const char *dbname, /*OUT*/ mco_db_h *db);
dbname
db
This function connects an application (thread) to a database. The database must have been previously opened by
mco_db_open(). It returns a connection handle that is passed to the other API functions to access the database.
MCO_S_OK
MCO_E_NOINSTANCE
Application snippet:
const char *dbname = "SimpleDb";
int main(int argc, char* argv[])
{
mco_db_h db;
MCO_RET rc;
mco_device_t dev;
mco_db_params_t db_params;
...
rc = mco_db_open_dev(dbname, simpledb_get_dictionary(), &dev, 1, &db_params);
if (MCO_S_OK != rc)
{
rc = mco_db_connect(dbname, &db);
...
}
...
}