每个连接的JDBC Statement / PreparedStatement [英] JDBC Statement/PreparedStatement per connection

查看:115
本文介绍了每个连接的JDBC Statement / PreparedStatement的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道每个连接可以同时打开多少个语句或预备语句。我真的不明白如果执行多个语句并检索多个结果集,它将如何工作。资源与详细信息的链接会有所帮助。

I was wondering how many statements or preparedstatements can be opened per connection at the same time. I don't really understand how would it work if multiple statements get executed and multiple resultssets are retrieved. Links of resources with details would be helpful.

谢谢

推荐答案

可以在同一连接上创建和使用多个语句,但只能在同一语句中创建和使用一个结果集。如果您通过相同的语句创建/打开另一个,则任何先前打开的结果集将被隐式关闭,导致任何尝试访问它的ResultSet已关闭异常。

Multiple statements can be created and used on the same connection, but only one resultset at once can be created and used on the same statement. If you create/open another one by the same statement, then any previously opened resultset will be implicitly closed, leading to "ResultSet closed" exceptions on any attempt to access it.

这篇关于每个连接的JDBC Statement / PreparedStatement的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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