Friday, February 15, 2013 5:09 AM
I am getting some connection / login issue when I try to connect SQL Server 2012 Enterprise Edition with Service Pack 1 (x64) from my application.
I checked SQL server logs and found few error entries (these entries are occurring multiple times in the logs)
02/07/2013 00:59:20,Logon,Unknown,Error: 18456<c/> Severity: 14<c/> State: 38.
02/07/2013 00:59:19,Logon,Unknown,Login failed for user <username>. Reason: Failed to open the explicitly specified database <DBName>. [CLIENT: <clientip>]
02/07/2013 00:59:14,Logon,Unknown,SQL Server is not ready to accept new client connections. Wait a few minutes before trying again. If you have access to the error log<c/> look for the informational message that indicates that SQL Server is ready before trying to connect again. [CLIENT: <clientip>]
02/07/2013 00:59:14,Logon,Unknown,Error: 17187<c/> Severity: 16<c/> State: 1.
Also suggest if it is correct forum for this question.
Friday, February 15, 2013 1:27 PMAnswerer
Reason: Failed to open the explicitly specified database <dbname>. </dbname>
The reason it is failing is that the login has a default_database specified either in the connection string or in the login properties in SQL Server and it either doesn't have access to that database or the database does not exist on that instance. Please double check your settings and connection strings and try it again.
Friday, February 15, 2013 6:03 PM
The problem is not that we can not login to the application while connected to the SQL server 2012. At the initial stage the login is occurring flawlessly but when we are spending like 3-4 hours strangely this bad connection problem is appearing. One more observation is keeping the application idle for considerable amount of time (4-5 hrs) this problem is again tending to occur.
Friday, February 15, 2013 6:48 PMFor me it sounds like an offline DB... Please check if the database in question has the "Auto Close" Option set to True. If so you could see exactly this behavior when SQL is not fast enough to get the closed database back up.
Saturday, February 16, 2013 12:43 AMAnswerer
I would have to agree, with the new information, it does seem that database could be closing and not waking up fast enough. If you absolutely need to use auto close (if it's enabled) or you aren't using auto close, setting the login timeout to a larger value could work for you to not get the errors upon first use... but I personally would never do this as there is a reason you bought enterprise edition.
Monday, February 18, 2013 11:44 AMWe checked "AutoClose" option but it is set to "False". So the problem is lying somewhere else. Sean, can you provide me the steps to increase login timeout.
Monday, February 18, 2013 12:20 PMAnswerer
Can you post the errorlog of the engine and of the application when this happens (including connection string)? There is obviously something going on that isn't right.
To set the login timeout, use the Timeout keyword and set it as a number of seconds in the connection string. Ex: Timeout=30