metricsign
Start free
High severityconnection

Power BI Refresh Error:
4060

What does this error mean?

The requested database does not exist, is offline, or the login has no access to it.

Common causes

  • 1The database name in the connection string is misspelled or does not exist
  • 2The database is offline or in single-user mode
  • 3The login has no user mapping in the target database

How to fix it

  1. 1Step 1: Verify the database exists and is online: SELECT name, state_desc FROM sys.databases WHERE name = 'targetdb';
  2. 2Step 2: Bring the database online if it is offline: ALTER DATABASE [targetdb] SET ONLINE;
  3. 3Step 3: Create a user for the login if missing: USE [targetdb]; CREATE USER [loginname] FOR LOGIN [loginname]; GRANT SELECT ON SCHEMA::dbo TO [loginname];

Frequently asked questions

How do I check if a database is in single-user mode?

Run: SELECT name, user_access_desc FROM sys.databases WHERE name = 'targetdb'. If user_access_desc shows SINGLE_USER, change it: ALTER DATABASE [targetdb] SET MULTI_USER;

Does error 4060 appear in Azure SQL Database?

Yes — typically when the database name in the connection string is wrong, or the SQL login is not mapped as a user in that database. Azure SQL does not have offline databases in the same sense as on-prem.

What is the difference between error 4060 and error 4064?

Error 4060 means the requested database cannot be opened. Error 4064 means the login's default database cannot be opened. Both often have the same root cause but are triggered at different points in the login process.

Official documentation: https://learn.microsoft.com/en-us/sql/relational-databases/errors-events/mssqlserver-4060-database-engine-error

Other connection errors