Documentation Home
MySQL NDB Cluster API Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 3.7Mb
PDF (A4) - 3.7Mb


2.1.2.2 API Initialization and Cleanup

Before using the NDB API, it must first be initialized by calling thendb_init() function.

Once an NDB API application is complete, you can callndb_end(0) to perform any necessary cleanup. Keep in mind that, before you invoke this function, allNdb_cluster_connection objects created in your NDB API application must be cleaned up or destroyed; otherwise, threads created when anNdb_cluster_connection object'sconnect() method is invoked do not exit properly, which causes errors on application termination. When anNdb_cluster_connection is created statically, you must not callndb_end() in the same scope as the connection object. When the connection object is created dynamically, you can destroy it usingdelete() before callingndb_end().

Each of the functionsndb_init() andndb_end() is defined in the filestorage/ndb/include/ndb_init.h.

Note

It should be possible to usefork() in NDB API applications, but you must do so prior to callingndb_init() ormy_init() to avoid sharing of resources such as files and connections between processes.