Re: Is there a reliable way to do this?
- From: Allen Kinsel <allen.kinsel@xxxxxxxxxxxxxxxx>
- Date: 09 Oct 2007 16:07:00 -0500
What is a reliable way to check to ensure that all system DBs are
started when SQL Server (SQL Express) starts up?
I am using SQL Express 2005 for a desktop application in which the user
requires the application be started at windows log-in time (so that
nothing is ever visible on the desktop except the application.)
Starting the application involves opening connections to two application databases.
When the application is started from the user's startup folder - that
is, right after log-in - there are often login failures reported by
..NetSQLClientData Provider - "Cannot open database [dbname] requested
by the login. The login failed. Login failed for user ...."
There are never any failures when started manually after login.
To deal with the things I THOUGHT might be causing this I made the
application check that the SQL Express service was running, and
increased the length of the connection time-out in the connection
string. Appears that these were not the cause of the problem. Examining
the SQL log shows that on startup, SQL Server has to start all its
internal databases. It looks like if this process is not complete
(usually it is the last db, tempdb, that isn't done with its startup)
my first connection fails. I suppose I could hardcode or put in the
configuration settings some sort of wait, or repeatedly try to open the
connection if the first time fails. But it seems like it would be safer to just know the status of the system dbs.
So, is there a way to do this?
Thanks!
Elizabeth
I think that there is really 2 approaches to this, one is to start sql
express prior to the application. That is to say, have the sqlexpress
service set to autostart (if this is feasible) If you do it this way the
service will be started and available by the time the logon screen comes
up otherwise if your already polling the service state and that's not working
im thinking that the only other real alternative would be to parse the
sql error log for the final "recovery complete" message. I would think
unless the user db's and/or tempdb database is rather large your probably
talking about milliseconds of timing on this issue.
-Allen
Posted by NewsLook (Trial Licence) from http://www.ghytred.com/NewsLook/about.aspx
.
- Follow-Ups:
- Re: Is there a reliable way to do this?
- From: Elizabeth Connolly
- Re: Is there a reliable way to do this?
- References:
- Is there a reliable way to do this?
- From: Elizabeth Connolly
- Is there a reliable way to do this?
- Prev by Date: Is there a reliable way to do this?
- Next by Date: Re: Is there a reliable way to do this?
- Previous by thread: Is there a reliable way to do this?
- Next by thread: Re: Is there a reliable way to do this?
- Index(es):
Relevant Pages
|
Loading