在线程之间共享连接

发布于 2024-10-10 09:19:08 字数 232 浏览 0 评论 0原文

来自 Derby 开发指南“在线程之间共享连接的陷阱” ,最好将每个线程分配给不同的连接。我想知道“如果一个线程提交,它会关闭使用同一连接的所有其他线程的语句和结果集”这一行为在所有 RDBMS 中还是仅在 Derby 中都是正确的? 谢谢。

From Derby development guide "Pitfalls of sharing a connection among threads", it is good practice to assign each thread to a distinct connection. I would like to know the behavior "If one thread commits, it closes the Statements and ResultSets of all other threads using the same connection" is true among all RDBMS or just Derby?
Thanks.

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

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

发布评论

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

评论(1

寂寞清仓 2024-10-17 09:19:08

确切的行为将取决于所使用的 RDBMS,但绝大多数会

  • 执行与 Derby 相同的操作,
  • 根本不支持使用相同连接的多个线程(即,如果从多个线程使用相同的连接,它可能会崩溃或产生其他未定义的行为) )。

The exact behaviour will depend on the RDBMS used, but the vast majority will either

  • do the same as Derby
  • not support multiple threads using the same connection at all (i.e. it may crash or produce other undefined behaviour if the same connection is used from multiple threads).
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文