Detecting when SQL Server 2005 Express ready to accept connections

S

Steve

Hi All

I have a windows application (written in VB.net 2005) which I update via web
downloads to my clients computers

The downloaded file is saved in a subfolder until the next time the clients
computer is started

An entry in the registry HKCU\Software\Microsoft\Windows\CurrentVersion\Run
launches my Update program on the next windows XP start

My update program often has to connect to SQL Server 2005 Express (On the
same computer) and here is the problem

100% of the time I get the message 'An error has occurred establishing a
connection to the server....... Could not open a connection to SQL Server'

I have gone so far as to repeatedly read the SQL Server log (In my update
program) looking for the sentence.. 'SQL Server is now ready for client
connections'

When this is found I break out of the loop and continue with my update
program code

But I still receive the error message.

If I run the Update program manually (even a few seconds later) all works
fine

If I Log Off the windows user and log back on the
HKCU\Software\Microsoft\Windows\CurrentVersion\Run entry launches my Update
Program and all works fine

Is is only when windows is restarting


How can identify when SQL Server is ready to accept connections in my VB.net
2005 code?

Regards
Steve
 
M

Michel Posseth [MCP]

Steve ,


I noticed the following behavior with one of my apps

Proggy is running and has connection to sql server 2005 , i disconnect the
network cable , a cathed exception occurs when trying to get data from SQL
(obvious )
however if i reconect the network cable and am able to connect with SMS to
sql server from this client , my proggy still blows up with an exception
that a connection could not be established
if i shutdown the proggy and restart everything works fine again .


I guess same thingy happens at your app , and i believe it is due to the way
how the provider works ( i guess it keeps track of a failed connect in some
way , client side connection pool perhaps ?? )
so i guess you first attempt needs to succeed

regards

Michel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top