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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lost ODBC connection (Error 1466,1526,...)

Status
Not open for further replies.

badukist

Programmer
Jun 26, 2003
146
RO
Hi.
I'm in process of converting an inhouse application to client-server, using remote views.
Seems that, if something is wrong with the ODBC connection ( TABLEUPDATE() fail because lost connection ), the only way to close the view and reopen it is TABLEREVERT() and all changes are lost. Anyone know if something can be done to "reconnect" the remote view and save changes ?
CURSORSETPROP("ConnectHandle", lnConnection) doesn't work, because is read only.
Or any other ideas?

Thanks in advance.
 
Badukist,

I would concentrate on finding out why you are getting lost connections in the first place. That shouldn't happen. If you can solve that, you won't have to worry about how to reconnect.

One area to explore is the timeout settings in your connection object.

Mike


Mike Lewis
Edinburgh, Scotland
 
Thanks for the reply.
What I am trying to do is to handle these errors if will happen. If I have a remote view with table buffering and something is wrong with the connection just before the user click on "Save" button and TABLEUPDATE() execution, this mean everything will be lost?
I know a fast way to verify if a connection is active or not, but what if doesn't :( ?


 
Badukist,

So, you are saying that you want a way to programmatically restore a connection after it has been lost, but without having to close the view as that would mean losing the data?

I don't know if that is possible. It is not something I would normally do in my applications -- at least, not with remote views. It might be easier with SQL pass-through. Perhaps someone else can help.

Mike


Mike Lewis
Edinburgh, Scotland
 
This is exactly what I want, if it is possible. We have a lot of detail lines to enter (hundreds), and will be a pain if all will be lost using table buffering.
Interesting, VFP knows how to reconnect if you set IdleTimeut property to a value.
I'm using Firebird server, and, if I set the IdleTimeout value to 1 minute, after 1 minute the server reports 0 connections, 0 databases. Immediately after TABLEUPDATE(), VFP reconnects and the server report 1 active connection. I thought that is possible somehow. If not, I must reconsider and use row buffering.

 
Badukist,

I'm confused about this. Surely, if you issue a TABLEUPDATE(), that will commit the changes. That's true whether you are using row or table buffering (provided that, with table buffering, the first parameter is 1 or .T.).

Mike


Mike Lewis
Edinburgh, Scotland
 
As I said, I want to be prepared, just in case something go wrong. Suppose that one enter 100 detail lines on a remote view with table buffering. After 30 minutes or more, will click on Save button. If the connection is gone, then what? I'm going to tell him "Everything is lost" ? . If I use row buffering, at least I can be sure that only the last line is lost.
But is not that bad. I've noticed that, if the IdleTimeout is set and the connection is lost at server side, after the time specified in IdleTimeout, VFP will try to reconnect. If succed, then WILL update data on server. And if it can't reconnect, I have the posibility to save changed/inserted records with GETNEXTMODIFIED() function.
The VFP help says that IdleTimeout is in seconds, but I've noticed that is in minutes.
 
Badukist,

Well. if the IdleTimeOut works, that's fine. Switching to row buffering should also solve the problem, because the data will be committed each time the record pointer moves. But I still think you should be able to call TABLEUPDATE() explicitly after each record has been added.

Mike


Mike Lewis
Edinburgh, Scotland
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top