s***8 发帖数: 1136 | 1 After creating a stmt from a connection, can I use the same stmt to execute
multiple queries with executeQuery() and executeUpdate()?
Is it better to create a new stmt for every query or update? These
operations are all in the same transaction.
Also curious why conn.createStatement()method does not take a sql string as
its param? The common expection for creating a statement is to pass in a
sql string.
What's the distinction between stmt.execute(), executeQuery(), executeUpdate
() methods? W | g*****g 发帖数: 34805 | 2
execute
Certainly you can do that.
It makes sense to use executeBatch if it's in one transaction.
as
Probably give you a chance to execute a batch.
executeUpdate
execute works for both, the other 2 are convenient functions to get results.
【在 s***8 的大作中提到】 : After creating a stmt from a connection, can I use the same stmt to execute : multiple queries with executeQuery() and executeUpdate()? : Is it better to create a new stmt for every query or update? These : operations are all in the same transaction. : Also curious why conn.createStatement()method does not take a sql string as : its param? The common expection for creating a statement is to pass in a : sql string. : What's the distinction between stmt.execute(), executeQuery(), executeUpdate : () methods? W
| s***8 发帖数: 1136 | 3 thanks, that's very helpful |
|