detecting that a SQL db is running

Tim Golden Tim.Golden at viacom-outdoor.co.uk
Fri Dec 1 03:55:39 EST 2006


[triode at xnet.co.nz]

| Sorry if i did not make myself clear.  let me try again.
| 
| I can detect when the db is up and not responding,  however,  
| if the DB does not start at all,  my local application hangs.  I need
to find a
| way to determine if the DB has started,  that's all.

Maybe (and only maybe) some code which will determine
when the corresponding Service has started would
suffice. There's probably a few ways to do that. Just
as a starter, try using WMI:

http://timgolden.me.uk/python/wmi.html

<code>
import wmi

c = wmi.WMI ()
for msde_service in c.Win32_Service (Name="Name-of-msde-service"):
  if msde_service.State == "Stopped":
    print "Not up yet"

</code>

If this worked, you could use WMI events, but be warned,
the most recent version of the WMI module has a bug in
the event class which someone's pointed out and patched
but which I haven't fixed yet. If you want to try WMI
(and to use that module) then download the previous
version; it'll work perfectly well for the purpose.

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list