为什么我通过 ODBC 调用的存储过程在同一位置失败?

发布于 2024-07-08 02:09:59 字数 1477 浏览 5 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

冰葑 2024-07-15 02:09:59

您是否尝试过在 SQL Server 端进行分析,看看您的 SPID 发生了什么?

另外,我没有使用过 freeodbc++,但也许其中有一个它不喜欢的 PRINT 语句。 您还可以 SET NOCOUNT ON 来抑制行计数消息。 同样,这取决于 freeodbc++ 对这些“信息性”消息的反应。

基于您描述的这种“冻结”行为风格,这听起来像是 freeodbc++ 中的一个错误。 首先检查 SQL 端的进程,看看它是否真的挂起,或者您的库是否只是“死掉”了。

Have you tried profiling on the SQL Server side, to see what is happening with your SPID?

Also, I have not used freeodbc++, but maybe there is a PRINT statement in there that it does not like. You could also SET NOCOUNT ON to suppress the row count messages. Again, this depends upon how freeodbc++ reacts to these "informational" messages.

It sounds like a bug in freeodbc++, based on this "freezing" style of behavior that you describe. Start with examining the process on the SQL side to see if it is really hung, or if your library just "died" on you.

你在看孤独的风景 2024-07-15 02:09:59

从查询分析器运行该过程,看看会发生什么。 您可以在过程中使用 RAISERROR() 函数将跟踪信息提供回消息窗口以帮助您进行调试。

Run the procedure from query analyzer and see what happens. You can use the RAISERROR() function in the procedure to provide tracing information back to the message window to help you debug.

念﹏祤嫣 2024-07-15 02:09:59

您尝试过使用 TRY 和 CATCH 吗? 它可能会在存储过程中的函数调用上引发您看不到的错误。

BEGIN TRY
 <Your code>
END TRY
BEGIN CATCH
        DECLARE @ErrMsg nvarchar(max),
            @ErrSeverity int,
            @ErrState int
    SELECT  @ErrMsg = ERROR_MESSAGE(),
            @ErrSeverity = ERROR_SEVERITY(),
            @ErrState = ERROR_STATE()

    RAISERROR (@ErrMsg,@ErrSeverity,@ErrState);
END CATCH

Have you tried using TRY and CATCH? It might be throwing an error on a function call within your stored procedure that you won't see.

BEGIN TRY
 <Your code>
END TRY
BEGIN CATCH
        DECLARE @ErrMsg nvarchar(max),
            @ErrSeverity int,
            @ErrState int
    SELECT  @ErrMsg = ERROR_MESSAGE(),
            @ErrSeverity = ERROR_SEVERITY(),
            @ErrState = ERROR_STATE()

    RAISERROR (@ErrMsg,@ErrSeverity,@ErrState);
END CATCH
一抹苦笑 2024-07-15 02:09:59

添加“::睡眠(30000);” 在对 ODBC 语句对象调用执行之后(以及语句关闭命令之前)立即阻止服务器进程过早退出。 一定是 freeodbc++ 的错误或者我的配置错误。

感谢您提供故障排除/调试提示。

Adding "::Sleep(30000);" immediately after I call execute on the ODBC statement object (and before the statement close command) keeps the server process from exiting prematurely. Must be a bug with freeodbc++ or a configuration error on my part.

Thanks for the troubleshooting/debugging tips.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文