How to Solve “Cannot open database (MS SQL Server) requested by login. The login failed”

Applies to:

  • MOBITEK SMS Engine version 5, 6, 7
  • SQL Server 2016 SP1 Express
  • Windows Server 2012 R2

Error Message: [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database “smseee6” requested by the login. The login failed.

Solution:

  1. Add “db_owner” to the user;
  2. If problem remains unsolved, then enable “TCP/IP” in SQL Server Configuration Manager.

How to Add “db_owner”

  1. select the user -> Properties
  2. goto “User Mapping”, select the database (smseee6) then check “db_owner”

Source: https://blog.sqlauthority.com/2009/08/20/sql-server-fix-error-cannot-open-database-requested-by-the-login-the-login-failed-login-failed-for-user-nt-authoritynetwork-service/

How to Enable “TCP/IP”

  1. Launch the SQL Server Configuration Manager. It should be in the Start -> Programs -> Microsoft SQL Server -> Configuration Tools, select “Protocols for SQLEXPRESS” and enabled “TCP/IP”.
  2. In “TCP/IP -> Properties”.
  3. In “TCP port”, ensure it is the correct port number 1433.
  4. Restart the servce.

Source: https://razorsql.com/docs/support_sqlserver_express.html