469,148 Members | 1,517 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,148 developers. It's quick & easy.

VB6 connection problem to MS SQL Server 7 table

I have a VB6 program on my PC that connects into and looks at a slq
server 7 table on a development server. This server is rebooted
everynight. Everytime the connection is interupted, an error message
pops up. This is expected to happen, but I wanted to delay this error
message from popping up and give the server a chance to reboot. I put
the statement

'cnn.ConnectionTimeout = 600' -> cnn is a new connection

to delay the vb program 10 minutes and then reconnect when the
connection is found. When the connection is found again - an error
message still pops up saying:

"The following error occured in the function BuildStepArray:
-2147467259
Description: Cannot open the database requested in login
'DBA_Utilities'. Login fails."

I wanted this delay in the vb program so an error message wouldnt pop
up unless the server was really down.
Does anyone know what this message could mean or how to fix this??
Thanks!

Mike

Jul 23 '05 #1
2 1649
I think your cnn object is getting corrupted after if finds the down
server. Maybe try it like this:

1. Trap for the down server message, if down then set cnn = nothing to
destroy it and set a svrdown flag to true
2. Use a vb timer control or a doevents loop to sleep for 10 minutes.
3. Try to reconnect. If still down and srvdown flg is true then
display a message
4. If able to reconnect then set svrdown flag back to false and
continue.

Dave

Jul 23 '05 #2
Mike (mc*****@gmail.com) writes:
I have a VB6 program on my PC that connects into and looks at a slq
server 7 table on a development server. This server is rebooted
everynight. Everytime the connection is interupted, an error message
pops up. This is expected to happen, but I wanted to delay this error
message from popping up and give the server a chance to reboot. I put
the statement

'cnn.ConnectionTimeout = 600' -> cnn is a new connection

to delay the vb program 10 minutes and then reconnect when the
connection is found. When the connection is found again - an error
message still pops up saying:

"The following error occured in the function BuildStepArray:
-2147467259
Description: Cannot open the database requested in login
'DBA_Utilities'. Login fails."

I wanted this delay in the vb program so an error message wouldnt pop
up unless the server was really down.
Does anyone know what this message could mean or how to fix this??


The message means that the database you are trying to access is not
available. The server is up, but for whatever reason the database is
not yet available. This could be because your DBA is running some
maintenance job, and keep the database in single-user mode.

However, I think the problem is that since you so eagerly keeps waiting
for the server to come up, you will get in as soon as SQL Server starts
to accept connections. However, at this point databases that needs recovery
will not be available. And I will guess that this is what's happening.

I would suggest that the best is set up an error handler, and catch
the connection-timeout message, and then wait for a couple of minutes
before you connect again. You would not extend the connection timeout.
Since even in this case there is a small risk that you knock on the
door when it just has opened, but the database is still in bed, you
should probably handle the "Cannot open..." message as well.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by JWM | last post: by
1 post views Thread by Hafez | last post: by
5 posts views Thread by Fred Zuckerman | last post: by
reply views Thread by Igor | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.