I'm writing a tool which is used to perform several database operations.
But the tool should only be used with one specific database.
Now I'm looking for a way, to securely identify the database, the tool is connected to.
First I thought about just checking a string like SERVERNAME\INSTANCE#Database
.
Also I found this question where the solution is to use a GUID, but this GUID changes if the DB is restored on another server.
The DB should be recognized even when it is being moved to another server or instance, or if the database name changes.
Is there a reliable way to achieve this?