English 中文(简体)
为何发言稿比声明更可取
原标题:Why PreparedStatement is preferable over Statement

虽然“制片声明”可以做一切事情, 即DDL、DDL相关询问的性能优于“声明”。

最佳回答

因为有些询问没有任何参数,所以编写并随后执行声明实际上可能比直接执行声明效率低。 在这种情况下,使用单一声明(并可能重新使用)也更容易读和直截了当。

http://docs.oracle.com/javase/6/docs/api/java/sql/Connection. html#create statement%28%29" rel=“nofollow” >the javadoc 说:

SQL statements without parameters are normally executed using Statement objects. If the same SQL statement is executed many times, it may be more efficient to use a PreparedStatement object.

问题回答

暂无回答




相关问题
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 ...

热门标签