When a database is created or added to a session, an automatic and unique identifier (UID) is associated with the database. A database UID is unique within the session.
A database UID is an unsigned long value that can be used as an alternative method to operate on databases, once the database is created or added to the session.
You can obtain a database UID with CTSession::GetDatabaseUID