Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic


Allocate and initialize a new database handle.


CTHANDLE ctdbAllocDatabase(CTHANDLE Handle)


ctdbAllocDatabase() allocates memory and initializes a new database handle and associates the handle with the session specified by Handle. Before any operations on a database can take place, the application must allocate a database handle.

  • Handle [in] - the session handle.

The next step in operating on a database is to connect the database handle returned by this function to the desired database (which has been previously added to the session specified by Handle) by calling ctdbConnect(). The database handle is released by calling ctdbFreeDatabase(). Do not release the database handle by calling the C runtime library function free().


ctdbAllocDatabase returns the database handle on success or NULL on failure.


CTHANDLE hDatabase = ctdbAllocDatabase(hSession);

See also

ctdbFreeDatabase(), ctdbAllocSession(), ctdbAllocTable()