This is because SharePoint's error handling treats the
UnauthorizedAccessException as a special exception and will ALWAYS redirect to the access denied page, there's even a special method to handle it:
You can turn this of by settings the following property:
SPSite.CatchAccessDeniedException = false;
P.S. it is not necessary to use an external database to get a list of all SPSite's a user has access to, this can be done using Search:Sites i have access to by Wonderlaura.
She mentions it is enterprise only, but since you are doing this in code, it'll work for any version but Foundation / WSS3 by using the
FullTextSqlQuery class and then query for
contentclass:STS_Site contentclass:STS_Web contentClass:sts_listitem_850