每个连接的JDBC Statement / PreparedStatement [英] JDBC Statement/PreparedStatement per connection
问题描述
我想知道每个连接可以同时打开多少个语句或预备语句。我真的不明白如果执行多个语句并检索多个结果集,它将如何工作。资源与详细信息的链接会有所帮助。
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屋!