Java Connection. Createstatement () method: create a statement object

Grammar 1

createStatement()

Example

Connection conn = …… //省略部分代码
Statement st = conn.createStatement();

Grammar 2

Statement createStatement(int resultSetType,int resultSetConcurrency)throws sqlException

Example

Connection conn = ……  //省略部分代码
Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);  //创建Statement对象

Grammar 3

Statement createStatement(int resultSetType,int resultSetConcurrency,int resultSetHoldability)throws sqlException

Example

Connection conn = ……  //省略部分代码  //创建Statement对象
Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY,ResultSet.HOLD_CURSORS_OVER_COMMIT);
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>