由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - jdbc statement question
相关主题
How to connect to SQL2000?Spring JDBC无法正确插入blob到MySQL
Java call stored procedure的一个问题关于java执行SQL之后的内存问题?
请教高手一个JDBC的问题!为啥RDBMS只用一个Index?
请教一个关于JDBC的问题,实在太烦了!Re: 有用netbeans的吗?
Re: JDBC 处理日期的问题(日期插入数据库)where to execute java program?
Re: JDBC用完了oracle的large pool (memory),怎么关于Exception,Catch
How to implement pushing data from database to user?a prepared statement question
jdbc/odbc MS Access file creation questionRe: 网上哪里有JDBC的入门书呢
相关话题的讨论汇总
话题: stmt话题: execute话题: statement
进入Java版参与讨论
1 (共1页)
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
1 (共1页)
进入Java版参与讨论
相关主题
Re: 网上哪里有JDBC的入门书呢Re: JDBC 处理日期的问题(日期插入数据库)
Re: JDBC question: getXXX methodsRe: JDBC用完了oracle的large pool (memory),怎么
Re: Need help with EJBHow to implement pushing data from database to user?
Re: JDBC, Java vs. Javascriptjdbc/odbc MS Access file creation question
How to connect to SQL2000?Spring JDBC无法正确插入blob到MySQL
Java call stored procedure的一个问题关于java执行SQL之后的内存问题?
请教高手一个JDBC的问题!为啥RDBMS只用一个Index?
请教一个关于JDBC的问题,实在太烦了!Re: 有用netbeans的吗?
相关话题的讨论汇总
话题: stmt话题: execute话题: statement