Error msg: Login failed for user... Reason: Failed to open the explicitly specified database 'JetSer

Copper Contributor
 

Hi Community,

 

May I know where do I check for errors like this? I'm using SQL Server Management Studio 2016

joshlabtech_1-1689846914479.png

 

Thank you!

4 Replies
In Management Studio Object Explorer, do you see this database? Is it Online or does it have a message to the right of the database? Things like (In Recovery) (Suspect) or is it normal? If it is normal then maybe that login does not have access to that database by login. Is the NT AUTHORITY\NETWORK SERVICE a login in the Logins? Is it mapped to that database?

The bigger question is what is using the NETWORK SERVICE login? Is it authorized to be used? This is normally not a login that you grant access to databases.

@joshlabtech , for each server login you can define a "Default database", like "JetServices" as in the error message.

But if the database isn't available for some reasons, the login attempt for the user. One reason, why it's not best pratice do define a user database as default; always define system database "master" as defautl.

See Create a Login - SQL Server | Microsoft Learn => Step 9 "From the Default database list, select a default database for the login. Master is the default for this option."

 

Hi @Ben_Miller_DBADuck 

 

Thanks for youre reply. I'm still quite new to sql so hope to have some guidance. May I know where can I see this NETWORK SERVICE login?

 

This error message has been happening everyday, but I don't recall we have anything that requires to login to sql everyday other than our backups.

Because the CLIENT indicates in the error message that it is from ::1 it means that it is from the local machine. NETWORK SERVICE could be a service that is logging in as that. You can see quickly if it is related to SQL Server services by going into the SQL Configuration Manager on the server and go to Services and see if NETWORK SERVICE is a login that uses this account.