PRB: "Cannot Open Default Database <ID>. Using Master Instead"

ID: Q196076


The information in this article applies to:


SYMPTOMS

When attempting to connect to Microsoft SQL Server, you may see the following message:

Cannot open user default database <ID>. Using master instead.
When attempting to login using Query Analyzer, the following error occurs:
Msg 4062 Severity 11 Cannot open user default database '%.*ls'. Using master database instead.
If the client is using an ODBC or OLEDB-based connection, it will not be allowed to log in to SQL Server as the message suggests. If the connection is DB-Library-based, the client will be able to successfully log in to SQL Server and be in the master database.


CAUSE

This error may occur for either of the following reasons:


WORKAROUND

To work around this problem, do either of the following:


MORE INFORMATION

If the login unable connect is sa, connect to SQL Server using command-line ISQL. Because ISQL uses DB-Library, you will be able to successfully connect and will be in the master database.

To use ISQL, perform the following steps:

  1. Open an MS-DOS command prompt and change to the <Sqlroot>\Binn directory (by default in SQL Server 7.0, this is the Mssql7\Binn directory).


  2. Type the following command to connect to SQL Server:
    isql -Usa -P<sa password> -S<server name>


  3. At the 1> prompt, issue the appropriate command from the Workaround section of this article to resolve the problem.


Additional query words: prodsql SEM can't connect failed GUI OLE DB dblib
db-lib open connectivity


Keywords          : 
Version           : winnt:7.0
Platform          : winnt 
Issue type        : kbprb 

Last Reviewed: August 12, 1999