Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ado and remote servers 1

Status
Not open for further replies.

topci

Programmer
May 6, 2005
16
SI
Hallo,

i need help. I have a writen a simple VB aplication to replicate a recordset from one server to another. I use ODBC connect to all servers. It's possible to geth information from the Server before i have open a connection to this server. In case, that server is not accesible, i geth ERROR like Time out ... How to check it's Server conected before i open a connection (not to geth a timeout error)

Tnx, DaT
 
So you do not wish to use the .Open() method of the ADO connection?

You could maybe PING the remote servers before trying to open the ADO Connection... that may save you from the times where the remote machine is flat out unavailable but not when the server host is up but the server prog is down.

Also, if one or both of these database servers are MS SQL Servers then consider using DTS to replicate data.

 
Thanks, i'm using DTS for datatransfer betwen two SQL Server, but in this case, (this is a small application writen for one of my customer) i need to use this application to transfare data from one server to another. How shuld i ping (or check) from VB application another server? Have you some sample to do this? How cann ping and wait for replay, not to geth system error (like Server not exist or Timeout...)

DaT
 
The SQLServer forums would be a better place to ask a DTS question.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
If you are just worried about getting an error then just use put some good error handling into your code.

Even if you can ping OK you still could face an error when you attempt to .Open the ADO Connection if the remote service is busy or otherwise not running.

Actually, even bad error handling might be good enough. Something ugly like this:
On Error Resume Next
adoConn.Open
If (Err.Number <> 0) Then
'we have an error!
Else
If (adoConn.Errors.Count <> 0) Then
'we have a different error
Else
If (adoConn.State <> 1) Then
'yes, this is also an error!
Else
'Everything is OK yay!!!!
End If
End If
End IF
On Error Goto 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top