Connect to a database.
MCO_RET mco_db_connect( /*IN*/ const char * dbname, /*OUT*/ mco_db_h *db);
dbname | The name of the database to connect to |
db | The address of a database handle for this database connection |
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 | The database was created successfully |
MCO_E_NOINSTANCE | The specified database is not opened |
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 ); ... } ... }