火鸟ISC错误代码:335544721 [英] Firebird ISC ERROR CODE:335544721

查看:170
本文介绍了火鸟ISC错误代码:335544721的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的客户最近报告了此错误,我们不知道该如何解决.我们正在使用Delphi XE6开发我们的应用程序,并将其作为后端连接到Firebird(v2.5)数据库.我们还使用IBObjects在Delphi中使用Firebird数据库.我们已经设法通过在运行查询之前停止Firebird Windows服务来在开发机上复制错误,但是我们还没有找到一种方法来检测代码中丢失的连接(例如,通过发生事件),因此我们不知道发生这种情况时,我们也无法使用代码重新连接到数据库.

We have had this error recently reported by our clients and we on't know how we can fix this. We are using Delphi XE6 to develop our application and it connect to Firebird (v2.5) database as back-end. We also have used IBObjects for working with Firebird database in Delphi. We have managed to replicate the error on the dev machine by stopping Firebird windows service before running a query but we haven't found a way to detect the connection lost in the code (e.g. by having an event) so as we don't know when this happens so we cannot reconnect to the database in the code either.

顺便说一句,如果有帮助,这是完整的错误消息:

By the way, this is full error message if it helps:

ISC错误代码:335544721ISC错误消息:无法完成对主机"BON-VFS-01"的网络请求.将数据写入连接时出错.

ISC ERROR CODE:335544721 ISC ERROR MESSAGE: Unable to complete network request to host "BON-VFS-01". Error writing data to the connection.

任何帮助都很感激.

推荐答案

来自IBOBjects 常见问题解答

From IBOBjects FAQ

有没有一种方法可以检测到丢失的连接并尝试重新连接自动,无需用户采取行动?

Is there a way to detect a lost connection and try to reconnect automatically, without user action?

进入OnError事件并查找表示一个失去了连接.然后,您可以采取所需的任何措施处理问题.如果连接断开,您需要做一个断开连接,然后再次连接.

Hook into the OnError event and look for the ERRCODE that denotes a lost connection. Then, you can take whatever action you deem necessary to deal with the problem. If the connection is lost you need to do a disconnect and then connect again.

并且从IBObject的基本成员之一开始:

And from one of the base members of the IBObjects:

但是,也许您所缺少的东西"是,如果连接由于外部原因而中断,客户端应用程序具有没有办法知道它仍然没有连接.它的第一个知识该事实将在下次尝试访问服务器时出现.这API将报告连接丢失到数据库"并返回GDSCODE335544741,由常量标识isc_lost_db_connection.

However, perhaps the "something" you are missing is that, if the connection is broken by an external cause, the client application has no way to know that it is not still connected. Its first knowledge of that fact will come the next time it tries to access the server. The API will report "Connection lost to database" and return GDSCODE 335544741, which is identified by the constant isc_lost_db_connection.

在发生此异常时,TIB_Connection仍然认为它已连接-Connected属性为true.如果你尝试通过调用Connect重新连接,您将收到一个IBO异常.有必要致电Disconnect.这不只是重置一个财产.Disconnect方法执行所有必要的清理使无效的交易无效并取消任何现在无效的交易发布,数据集和缓存.断开连接完成后工作,然后可以在重试循环内放置一个Connect调用,然后尝试再次尝试.

At the point where this exception occurs, the TIB_Connection still thinks it is connected - the Connected property will be true. If you try to reconnect by calling Connect, you will get an IBO exception. It is necessary to call Disconnect. This does not simply reset a property. The Disconnect method performs all of the necessary cleanup to invalidate the broken transactions and cancel any now invalid postings, datasets and caches. Once Disconnect has completed its work, you can then place a Connect call inside a retry loop and attempt to get going again.

我不知道一个有效的例子,但是最简单的处理方法这是要编写一个RestoreConnection处理程序过程,您可以每当参数ERRCODE时从您的IB_Session.OnError处理程序调用返回isc_lost_db_connection.

I do not know of a working example, but the simplest way to deal with this is to write a RestoreConnection handler procedure that you can call from your IB_Session.OnError handler whenever argument ERRCODE returns isc_lost_db_connection.

让您的RestoreConnection过程执行您需要做的一切,尝试调用Connect并处理如果请求失败,直到没有异常发生.测试连接属性每次迭代之后.当连接"最终为真"时,您就处于商业.您可以退出重试代码,并通知用户连接已恢复-可能有声音和/或状态栏中显示一条消息,以避免必须显示一个对话框她必须回应.(如果您喜欢声音和状态栏的想法提示,您可以设计连接丢失"警告声音和状态栏在处理程序过程开始时运行的消息代码,如下所示:好吧...)

Have your RestoreConnection procedure do whatever you need to do, trying to call Connect and handling the exception that occurs if the request fails, until no exception occurs. Test the Connected property after each iteration. When Connected is finally True, you are in business. You can drop out of the retry code and inform the user that the connection has been restored - perhaps with a sound and/or a message in the status bar, to avoid having to show a dialog box that she has to respond to. (if you like the idea of sound and status bar cues, you could devise "connection lost" warning sound and status bar message code to run at the beginning of your handler procedure as well...)

如果这些断开的连接频繁发生,您可能会喜欢考虑制作一个可以显示的独特自定义光标在您的过程运行时,将重试代码包含在启用UseCursor且不产生收益的BeginBusy ... EndBusy块,并且BusyCursor设置为使用此特殊光标图像.

If these broken connections are a frequent occurrence, you might like to consider making a distinctive custom cursor that you can display while your procedure is running, and enclose the retry code in a non-yielding BeginBusy...EndBusy block with UseCursor enabled and BusyCursor set to use this special cursor image.

如果重新建立连接可能需要很长时间,或者要暂时不可能,您需要提供能力供用户干预并选择不继续尝试.您可以使用为此的会话计时器,将您的忙碌"块包含在其中另一个迭代块提示用户取消"或保持"尝试",并在合理的间隔内进行.

And if re-establishing a connection is likely to take a long time, or to be temporarily impossible, you would need to provide the ability for the user to intervene and choose not to keep trying. You can use the session timer for this, enclosing your "busy" block inside another iterative block the prompts the user to "Cancel" or "Keep Trying", at reasonable intervals.

来源

这篇关于火鸟ISC错误代码:335544721的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆