为什么运行时上下文在为 10g 编译的程序中不能在 11g 上工作?

发布于 2024-10-21 06:28:00 字数 419 浏览 1 评论 0原文

我有一个使用 Oracle 10g(pro*c 和库)编译的多线程 C 应用程序。该程序每个线程使用一个数据库连接。我们正在转向 11g,并且在针对 11g 进行测试时,任何使用全局上下文以外的上下文的内容都会在连接到数据库时生成 SQL-02134:无效的运行时上下文。使用全局上下文效果很好。这是从 10g 到 11g 过渡过程中已知的不兼容性,还是我做错了什么?我最终将针对 11g 重新编译所有内容,但出于实现目的,如果我们可以运行 10g 程序直到所有数据库都转换完毕,就会容易得多。

就其价值而言,该代码包含我认为正常的内容:

EXEC SQL ENABLE THREADS;
EXEC SQL CONTEXT ALLOCATE :thread_ctx
EXEC SQL CONTEXT USE :thread_ctx

I've got a multi-threaded C application that was compiled using Oracle 10g (pro*c and libraries.) The program uses one database connection per thread. We're moving to 11g and in testing against 11g, anything that uses a context other than the global context generates an SQL-02134: Invalid runtime context when connecting to the database. Using the global context works fine. Is this a known incompatibility in the transition from 10g to 11g, or am I doing something wrong? I will eventually recompile everything against 11g, but for implementation purposes, it's much easier if we can run the 10g program until all the databases are converted.

For what it's worth, the code includes what I believe to be the normal things:

EXEC SQL ENABLE THREADS;
EXEC SQL CONTEXT ALLOCATE :thread_ctx
EXEC SQL CONTEXT USE :thread_ctx

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

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

发布评论

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

评论(2

冷情妓 2024-10-28 06:28:00
SQL-02134: Invalid runtime context 

Cause: The runtime context associated with this statement has not been properly allocated.

Action: Rewrite the application to execute the EXEC SQL CONTEXT ALLOCATE statement before executing any SQL statements.

所以,我猜既然你说代码在执行 SQL 语句之前包含该语句,那么在执行所述 sql 之前上下文将被清除。

运行某种调试器来生成跟踪文件,以查看问题传播的具体位置。

SQL-02134: Invalid runtime context 

Cause: The runtime context associated with this statement has not been properly allocated.

Action: Rewrite the application to execute the EXEC SQL CONTEXT ALLOCATE statement before executing any SQL statements.

So, I would guess since you said that the code includes that statement before executing the SQL statement that the context is being cleared before you execute said sql.

Run a debugger of some kind to produce a trace file to see where exactly the issue is propagating.

浪推晚风 2024-10-28 06:28:00

使用前声明您的上下文

EXEC SQL 开始声明部分;
sql_context thread_ctx;
EXEC SQL 结束声明部分;

Declare your context before usage

EXEC SQL begin declare section;
sql_context thread_ctx;
EXEC SQL end declare section;

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