Abstract
This class represents the NDB kernel; it is the
primary class of the NDB API.
Parent class. None
Child classes. None
Description.
Any nontrivial NDB API program makes use of at least one instance
of Ndb. By using several Ndb
objects, it is possible to implement a multi-threaded application.
You should remember that one Ndb object cannot
be shared between threads; however, it is possible for a single
thread to use multiple Ndb objects. A single
application process can support a maximum of 4711
Ndb objects.
The Ndb object is multi-thread safe in that
each Ndb object can be handled by one thread at
a time. If an Ndb object is handed over to
another thread, then the application must ensure that a memory
barrier is used to ensure that the new thread sees all updates
performed by the previous thread.
Semaphores and mutexes are examples of easy ways to provide memory barriers without having to bother about the memory barrier concept.
It is also possible to use multiple Ndb objects
to perform operations on different clusters in a single application.
See Application-level partitioning, for
conditions and restrictions applying to such usage.
Methods. The following table lists the public methods of this class and the purpose or use of each method:
| Method | Purpose / Use |
|---|---|
Ndb() |
Class constructor; represents a connection to a MySQL Cluster. |
~Ndb() |
Class destructor; terminates a Cluster connection when it is no longer to be used |
closeTransaction() |
Closes a transaction. |
computeHash() |
Computes a distribution hash value. |
createEventOperation() |
Creates a subscription to a database event. (See
Section 2.3.18, “The NdbEventOperation Class”.) |
dropEventOperation() |
Drops a subscription to a database event. |
getDictionary() |
Gets a dictionary, which is used for working with database schema information. |
getDatabaseName() |
Gets the name of the current database. |
getDatabaseSchemaName() |
Gets the name of the current database schema. |
getGCIEventOperations() |
Gets the next event operation from a GCI. |
getNdbError() |
Retrieves an error. (See Section 2.3.17, “The NdbError Structure”.) |
getNdbErrorDetail() |
Retrieves extra error details. Added in MySQL Cluster NDB 6.2.19, MySQL Cluster NDB 6.3.29, and MySQL Cluster NDB 7.0.10. |
getReference() |
Retrieves a reference or identifier for the Ndb
object instance. |
init() |
Initializes an Ndb object and makes it ready for use. |
nextEvent() |
Returns the next event operation. |
pollEvents() |
Waits for an event to occur. |
setDatabaseName() |
Sets the name of the current database. |
setDatabaseSchemaName() |
Sets the name of the current database schema. |
startTransaction() |
Begins a transaction. (See Section 2.3.27, “The NdbTransaction Class”.) |
For detailed descriptions, signatures, and examples of use for each
of these methods, see Section 2.3.13.1, “Ndb Methods”.
Class diagram.
This diagram shows all the available members of the
Ndb class:

