Documente Academic
Documente Profesional
Documente Cultură
** NOTE **
According to DBMS sql queries are :-
i)DDL (create , alter …)
ii)DML (insert , update , delete)
iii)DRL(select)
iv)TCL(commit , rollback , ….)
➔ According to jdbc persistence logic there are two types of sql statements .
o Select sql query (DRL)
o Non-Select sql query (DDL,DML,TCL …..)
➔ Select sql query execution returns single record or bunch of record that are selected
from database table .
➔ Non-select sql query returns a numeric value representing no of records effected
because of query esecution.
➔ JDBC api related predefined library has given following methods for execution of select
and non select sql queries .
o executeUpdate(--) :-
-> Our jdbc application will use executeUpdate() to send and execute non-
select sql query database software.
-> when JVM encounter updation group SQL Query with execteUpdate()
method the JVM will pickup That Sql Query and send to Database through
Database connection.At Database side Database engine Will execute
it,perform updation from Database,identify rowCount value (number of
records got updated) and return to Java application.
->As per the predefined implementation of executeUpdate() method JVM
will return row count value From executeUpdate() method.
-> Public int executeUpdate(String sql_Query) throws SQLException
EX: int rowCount=st.executeUpdate(“update emp1 set esal=esal+500 where
esal<1000”);
o executeQuery(---) :-
o Our jdbc application will use executeQuery() to send and execute select sql
query in database software.
o when JVM encounter executeQuery() method with selection group SQL
query then JVM will pickup Selection group SQL Query,send to
JdbcOdbcDriver, connection will carry that SQL Query to the database
engine through Odbc Driver.
o At database database engine will execute the selection group SQL Query by
performing Query Tokenization,Query parsing,Query optimization and
Query Execution.
o This method will return jdbc resultSet object having set of records selected
from data base software.
o Public ResultSet executeQuery(String sql_Query) throws SQLException
o EX: ResultSet rs=st.executeQuery(“select * from emp1”);