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


2.1.2.2 API Initialization and Cleanup

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

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

Each of the functions ndb_init() and ndb_end() is defined in the file storage/ndb/include/ndb_init.h.

Note

It should be possible to use fork() in NDB API applications, but you must do so prior to calling ndb_init() or my_init() to avoid sharing of resources such as files and connections between processes.