Cannot open database "...." requested by the login. The login failed.

Cannot open database "...." requested by the login. The login failed.

Issue:

When trying to open Forecast 5, you are receiving the error below:


SqlException

Cannot open database "Forecast5V3_2018" requested by the login. The login failed.

Login failed for user 'Navsoft\JohnDoe'.

at Forecast5.DataAccessLayer.Forecast5Db_SQL2008.ExecuteNonQuery(String command)

at Forecast5.DataAccessLayer.Forecast5Db_SQL2008.RemoveThirdPartyViews()

at Forecast5.View.MainWindow..ctor()

at Forecast5.View.App.OnStartup(StartupEventArgs e)

at System.Windows.Application.<.ctor>b__1_0(Object unused)

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)


Cause:


This error message indicates that the user specified (highlighted above) does not have access to the database (italicised above).


Solution:


You will need to add the user to have permissions to access the database as per the steps below:



1. Open up Sql Server Management Studio, connect and login (using administrative permissions) to the SQL and Instance the database is stored on.

2. Once logged in, expand Security, right-click and select New Login:

2. Select Search from the main page, enter the name you wish to add and click Check Names. This will underline if the username exists. Click Ok.



3.Under Server Roles, tick sysadmin.



4. Under User Mapping, tick your database name and add db_owner.



5. Click Ok to save.

With these instructions, you can add any user that needs permission.


Note: Forecast 5 support can assist with this issue as long as we have been provided with the administrative login to the SQL Server.


    • Related Articles

    • SQLException: Failed to update database... because the database is read-only

      Issue/Error: When opening Forecast 5, you are receiving an error: Forecast5 cannot continue because of an exception occured: SqlException. Failed to update database "[database name]" because the database is read-only. Forecast 5 will fail to open. ...
    • How To Update Your Login Details

      If you would like to personalise your username and password for Forecast 5, login to Forecast 5 with the default details: Username: Admin Password: (blank) Then go to Update Current User Change the username, enter the old password and enter a new ...
    • Database creation: NullReferenceException

      Issue: When trying to create a new database, you are receiving the following error but the database is still created in SQL:  NullReferenceException Object reference not set to an instance of an object. Cause: This is caused by attempting to connect ...
    • Update the config file - point Forecast 5 to a new server or database.

      If you have a network license and you wish to store the Forecast 5 database on a server, you will need to update the config file to point to the correct server and database. On the server, go to this path: C:\ProgramData\Forecast 5 Ltd Edit the file ...
    • Sending Your Database To Support

      To send your database to support for investigation, please follow the steps below: 1. C:\ProgramData\Forecast 5 Ltd 2. Copy the data folder to your desktop in a zip folder. 3. Attach the zip folder to an email and send to support@forecast5.com