Previous Topic

Next Topic

Creating a new Database

Use ctdbCreateDatabase() to create a new database. ctdbCreateDatabase() takes a session or a database handle, the database name and the path where the database dictionary file is to be located. If the database path is NULL or empty (“”) the database is created in the server directory for client/server applications, or in the current directory for standalone applications.

/* create a new database MyDatabase */
if (ctdbCreateDatabase(hSession, “MyDatabase”, “”) != CTDBRET_OK)
{
   printf(“Create database failed\n”);
}

ctdbCreateDatabase() creates a new database dictionary file with the database name and extension .FDD (FairCom Database Dictionary). Using the example above, the database dictionary file created is MyDatabase.fdd.