Cannot find the user 'foraydbadmin', because it does not exist or you do not have permission.

 Problem

An error occurs trying to install or upgrade Foray ADAMS. The error includes the following:

Cannot find the user 'foraydbadmin', because it does not exist or you do not have permission.

This error may occur when trying to execute the following command on a Microsoft SQL Server database.

GRANT SUBSCRIBE QUERY NOTIFICATIONS TO foraydbadmin

The error may also appear as:

Error communicating with the database.DB Transaction Failed. Command = GRANT SUBSCRIBE QUERY NOTIFICATIONS TO foraydbadmindevClick Cancel to exit the application

 Solution

This error can occur when the foraydbadmin account has not been explicitly added to the database.

  1. Open Microsoft SQL Server Management Studio

  2. Databases > ForayAdams > Security > Users

  3. If you do not see foraydbadmin under the list of users then this is the issue

  4. Right-click dbo and select Properties

  5. Make sure the Login name is not foraydbadmin. If it is then:

    1. Open a query window

    2. Execute the command ALTER AUTHORIZATION ON DATABASE::[ForayAdams] TO [sa];

    3. This will change the dbo login from foraydbadmin to sa

  6. Right-click Users and select New User…

  7. General page:

    1. User name: foraydbadmin

    2. Login name: foraydbadmin

    3. Default schema: dbo

  8. Membership page:

    1. db_datareader

    2. db_datawriter

    3. db_owner

  9. OK

Now that the foraydbadmin account has been explicitly added to the database it will be able to find the user when performing actions such as granting permissons.

© 2023 Foray, LLC - All Rights Reserved