Some notes about Statement in Jdbc
What is Statement ?
Its a Factory in JDbc for ResultSet, you can see this.
JDBC :
#Connection
##Statement
###PrepareStement,CallableStatement
####ResultSet
Can you Undestand this relationship ? its from big to small in jdbc.
@addBatch // CRUD many sql
Example : Statement statment = connecntion.createStatement();
statement.addBatch(sql1);
statement.addBatch(sql2);
statement.addBatch(sql3);
statement.close();
@clearBatch(); //its for clear sql .
Example :
Statement statment = connecntion.createStatement();
statement.addBatch(sql1);
statement.addBatch(sql2);
statement.addBatch(sql3);
statement.clearBatch(); // clearBatch();;
statement.close();
@executeUpdate(), execute ,clearWarning();
Example : Statement stmt = conn.createStatement();
stmt. clearWarnings();
@getFetchSize();
Examle :System.out.println(stmt. getFetchSize());
@getGenercKeys();
Example : ResultSet rs = stmt.getGeneratedKeys();
@getMoreResulet();
Example :Statement stmt = conn.createStatement();
if(stmt.getMoreResults(Statement.CLOSE_ALL_RESULTS)){
System.out.println("");
}
Note : if you learned this all , that u can say you know jdbc about 20%。 Goodluck.
Iaprhan_Java 2016-6-18
What is Statement ?
Its a Factory in JDbc for ResultSet, you can see this.
JDBC :
#Connection
##Statement
###PrepareStement,CallableStatement
####ResultSet
Can you Undestand this relationship ? its from big to small in jdbc.
@addBatch // CRUD many sql
Example : Statement statment = connecntion.createStatement();
statement.addBatch(sql1);
statement.addBatch(sql2);
statement.addBatch(sql3);
statement.close();
@clearBatch(); //its for clear sql .
Example :
Statement statment = connecntion.createStatement();
statement.addBatch(sql1);
statement.addBatch(sql2);
statement.addBatch(sql3);
statement.clearBatch(); // clearBatch();;
statement.close();
@executeUpdate(), execute ,clearWarning();
Example : Statement stmt = conn.createStatement();
stmt. clearWarnings();
@getFetchSize();
Examle :System.out.println(stmt. getFetchSize());
@getGenercKeys();
Example : ResultSet rs = stmt.getGeneratedKeys();
@getMoreResulet();
Example :Statement stmt = conn.createStatement();
if(stmt.getMoreResults(Statement.CLOSE_ALL_RESULTS)){
System.out.println("");
}
Note : if you learned this all , that u can say you know jdbc about 20%。 Goodluck.
Iaprhan_Java 2016-6-18