[program-l] Re: VB6: Connection Object

  • From: "Mark Long" <Mark.Long@xxxxxxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Wed, 7 Sep 2005 12:37:19 +0100

Well, I am certainly confused.

Unfortunately, this is one of those situations where there is no meaningful 
answer, in a sense. Let's imagine that the connection object had a method 
called IsServerReachable that returned true or false. Let us further imagine 
that we had code a lot like this air code

If MyConn.IsServerReachable then
  ' great - I can write to the DB and there will be no error
  WriteToDatabase
End if

You will get errors on WriteToDatabase because the validity of the data has a 
very short lifetime indeed. The server may have been fine one clock cycle ago 
but be gone now. All that you could tell is that it was reachable last time 
that you asked. 

The only way to ever be sure with these things is to use a transactional 
system. I would suggest that MSMQ would not be overkill here. You might want to 
check out ACID on MSDN.

I know that this seems like it is a lot of work but I don't know of a simple 
and easy way of making a reliable failover system.

Sorry

Mark

-----Original Message-----
From: program-l-bounce@xxxxxxxxxxxxx [mailto:program-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Corbett, James
Sent: 07 September 2005 11:50
To: 'program-l@xxxxxxxxxxxxx'
Subject: [program-l] Re: VB6: Connection Object

Mark:

Well here is the situation. I have a primary application and database, a
secondary application and a copy of the primary database connected to the
primary application.

The purpose of the secondary application and copy of the primary database is
in the event of a system failure.

When I load the primary app, it validates the remote secondary location and
if I get a true back then it copies it's primary database to the secondary
location and opens a second ADODB object.

If we lose the primary system, we can fire up the secondary application and
continue on using the primary backup as if there was no issue.

When I write to the primary db after the secondary is copied and open I
always check to see if the secondary is still with us. If yes (assumed) then
I write to both files at or near the same time.

The trouble is that I check the state of the secondary system with
secondary.state. If it returns 1 then I have always assumed that the
secondary ADODB object is viable therefore I can write to it. However, I can
absolutely confirm that my data is written to the primary but the secondary
is not updated although the secondary object.state property has returned 1.

Hmmm, a we bit confused and bewildered.

Jim 

-----Original Message-----
From: Mark Long [mailto:Mark.Long@xxxxxxxxxxxxx]
Sent: September 6, 2005 12:09 PM
To: program-l@xxxxxxxxxxxxx
Subject: [program-l] Re: VB6: Connection Object


ADO tracks the state internally.

Jim, what makes you think that the database may have gone away unexpectedly?

-----Original Message-----
From: program-l-bounce@xxxxxxxxxxxxx [mailto:program-l-bounce@xxxxxxxxxxxxx]
On Behalf Of David Lant
Sent: 06 September 2005 17:08
To: 'program-l@xxxxxxxxxxxxx'
Subject: [program-l] Re: VB6: Connection Object

Hi Jim,

One would have thought that it checks the actual connection to the database,
as you can use it not only to find out if the connection is open or closed,
but what it is actually doing at the time.  E.g. you can compare the State
property against the adStateOpen, adStateClosed, adStateExecuting,
adStateFetching and adStateConnecting constants.

David Lant

I.T. Consultant 
Consultancy & Development
ICT Services
Tel: (01392) 382464

Devon County Council accepts no legal responsibility for the contents of
this message. The views expressed do not reflect those of Devon County
Council.


-----Original Message-----
From: Corbett, James [mailto:James.Corbett@xxxxxxxxxxxxxxx] 
Sent: 06 September 2005 16:56
To: Program-L (E-mail)
Subject: [program-l] VB6: Connection Object


Hello all:

I have the need to frequently check my ADO Connection object for viability.
If I use the Object.State property does that actually check the connection
to the database or simply the existance of the object in memory?

Jim 



James M. Corbett

(613) 941-8303 | facsimile / télécopieur 613 941-8720 | TTY/ATS
1-800-665-0354 James.Corbett@xxxxxxxxxxxxxxx IT Programmer/Analyst | GST/HST
Division | Information Technology Branch Programmeur/Analyste en technologie
de l'information | Division de la TPS/TVH | Direction générale de
l'informatique Canada Revenue Agency | 875 Heron Rd., Ottawa, ON K1A 0L5 
Agence du revenu du Canada | 875 Ch. Heron, Ottawa ON K1A 0L5 Government of
Canada | Gouvernement du Canada

"The following Ha Ha is not for amusement, but an expression of contempt...
Ha Ha!"

Nelson Mudge

Now this is not the end. It is not even the beginning of the end. but it is,
perhaps, the end of the beginning."

Winston Churchill


** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: