473,956 Members | 9,861 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Connection Timeout = 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 1854
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.Connection Timeout = 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****@sommarsk og.se

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4757
by: JWM | last post by:
I am trying to implement Oracle connection pooling for the following code, which was written by someone else. Here is my main question -- this java file creates code that is executed every hour, but once per week, the oracle server is brought down for backup. At that time, I get an error that looks like I have the wrong credentials for the database. For every subsequent attempt to run the hourly process, I am getting a broken pipe error,...
1
1726
by: Hafez | last post by:
Hi All The problem:!! I want to create a temp table which is common between different users so that each user could select his rows and print them without printing others selection. All clients use the same connection string. Is there a way to identify users? I think it's possible to delete rows of a user when he logs out the program. Do I think right?
5
8762
by: Fred Zuckerman | last post by:
Hello All, After reading in this group about the preference for connecting to a SQL Server using a connection string instead of a DSN file, I have done just that. BUT, I cannot update my data. I have gone back and forth between using a DSN file and a DSN-less connection string and I have found the following issue. When I utilize the DSN file to create the link, there is a step where it asks me to identify a unique key for the file. If I...
1
5540
by: Lyle Fairfield | last post by:
I created a new MS-SQL Database, "TestODBC". I made Table1 and StoredProcedure1. I made an ODBC DSN for that MS-SQL Database. I created a new AccessXP mdb, "TestODBC". I linked to the table of the MS-SQL Database, "TestODBC". I wanted to use StoredProcedure1 as the bound recordsource for a new form Form1. But I
0
3755
by: Igor | last post by:
An error "ODBC connection to failed" is raised when I am trying to get data from a table in Microsoft Access (97, or 2000) which is actually a linked table to another table in SQL Server 7 . The exception is raised from a Web .Net app while exactly the same code works fine in Windows .Net app. That makes me thinking the issue somehow is related to security context. Anyway I do not know how to solve the problem, and any help is...
7
11266
by: Henry | last post by:
I am writing a Windows forms VB.Net/MS SQL application via VS 2003 that utilizes Crystal Reports. I want to be able to dynamically set the report data source at run time. I'm trying to change the the reports "integrated security" from TRUE to FALSE via the "Set Location" dialog in the report designer with no success. It is not intuitive (at least not to me.) I get the following error:
4
1733
by: ruben | last post by:
Hi: I'm getting this error when accessing a table with certain WHERE condition: "server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Failed." I've read through the posts but found no answer to the problem.
6
8176
Cintury
by: Cintury | last post by:
Hi all, I've developed a mobile application for windows mobile 5.0 that has been in use for a while (1 year and a couple of months). It was developed in visual studios 2005 with a back-end sql server mobile ce database. Until recently I was synching everything thru a com port serial cable. The devices would connect to the computer thru activesync and are able to acquire an internet connection. The sync for the program occurs thru a website...
3
3458
by: irkahs | last post by:
Hello all, I am using an SQL select statement to store the result into a variable. This variable then needs to get into a table. I am having issues with it. Kindly help. I am providing below the code. 'First table variables Dim sql_insert, con, data_source 'Second table variables Dim sql_insert2, con2, data_source2
1
1968
by: BobLewiston | last post by:
I’m trying to learn how to connect to an SQL Server database (I’m using the AdventureWorks sample database), but I’m having problems. Here’s the code I’m using: // define connection string for database server string connectionString = "server=<server name>; database=AdventureWorks; uid=<user name>; pwd=;"; // no password // define SqlConnection connection to database using connection string SqlConnection conn = null; try
0
10029
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
11436
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10745
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9952
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8323
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6271
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6396
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4595
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3604
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.