English 中文(简体)
回归类型作为方法结果有哪些缺点
原标题:What are disadvantages to return type as resultset in method
  • 时间:2011-11-22 07:00:03
  •  标签:
  • jdbc

What are side effects when iam return a Resulset(java.sql.ResultSet) in the method using java.

问题回答

It leaks the ResultSet out of the method. This means that it is up to the caller to clean up the Connection. Only do this if the ResultSet contains too much data to simply copy it into memory (and then close it within the method), and if the caller can be expected to manage database connections (for example, when the Connection was passed into the method as a parameter as well).





相关问题
MaxPooledStatements setting in JDBC oracle

I can t figure out how to set MaxPooledStatements in Oracle using the Oracle thin JDBC driver. Could someone point me in the right direction?

pass ResultSet from servlet to JSP

I am doing the following in my SampleServlet.java //Fill resultset from db .... try { ArrayList Rows = new ArrayList(); while (resultSet.next()){ ArrayList row = new ArrayList(); ...

How to correctly use ResultSet with h:dataTable

The problem is, that after displaying the ResultSet with <h:dataTable>, the connection is left open. If I close it, it closes the ResultSet too. I m thinking about copying the ResultSet data ...

Mysql session variable in JDBC string

am using this connection string to connect to mysql from java: jdbc:mysql://localhost:3306/db?noDatetimeStringSync=true&useUnicode=yes&characterEncoding=UTF-8 is it possible to set the ...

热门标签