ttDestroyDataStore

Description

Destroys a database, including all checkpoint files, transaction logs and daemon catalog entries corresponding to the database specified by the connection string. It does not delete the DSN itself defined in the sys.odbc.ini or user odbc.ini file on Linux or UNIX platforms or in the Windows registry on Windows platforms.

Required Privilege

Instance administrator

Syntax

ttDestroyDataStore (ttUtilHandle handle, const char* connStr,
                    unsigned int timeout)

Parameters

Parameter Type Description

handle

ttUtilHandle

Specifies the TimesTen utility library environment handle allocated using ttUtilAllocEnv.

connStr

const char*

This is a null-terminated string specifying the connection string that describes the database to be destroyed. All attributes in this connection string, except the DSN and the DataStore attribute, are ignored.

timeout

unsigned int

Specifies the number of times to retry before returning to the caller. ttDestroyDataStore continually retries the destroy operation every second until it is successful or the timeout is reached. This is useful in those situations where the destroy fails due to some temporary condition, such as when the database is in use.

No retry is performed if this parameter value is 0.

Example

This example destroys a database defined by the payroll DSN, consisting of files C:\dsns\payroll.ds0, C:\dsns\payroll.ds1, and several transaction log files C:\dsns\payroll.logn.

char            errBuff [256];
int             rc;
unsigned int    retCode;
ttUtilErrType   retType;
ttUtilHandle    utilHandle;
...
...
rc = ttDestroyDataStore (utilHandle, "DSN=payroll", 30);
if (rc == TTUTIL_SUCCESS)
   printf ("Datastore payroll successfully destroyed.\n");
else if (rc == TTUTIL_INVALID_HANDLE)
   printf ("TimesTen utility library handle is invalid.\n");
else
  while ((rc = ttUtilGetError (utilHandle, 0, &retCode,
           &retType, errBuff, sizeof (errBuff), NULL)) !=
           TTUTIL_NODATA)
    {
  ...
  ...
}