What are the different types of statements?
Answers were Sorted based on User's Feedback
Answer / chandrarekha
Statement interface----createStatement() method is useful
to create statement object and to execute simple queries...
PreparedStatement interface---derived from the Statement
interface...preparestatement() method used to create
preparedstatement object and used to execute queries with
unknown parameters or where in the parameters are provided
at the run-time
CallabaleStatement interface----derived from the
preparedstatement interface and helpful in executing stored
procedures...prepareCall() method is used to create the
callabalestatement object
| Is This Answer Correct ? | 45 Yes | 6 No |
Answer / niranjanravi
statement
preparedstatement
callable sattement
| Is This Answer Correct ? | 29 Yes | 9 No |
Answer / rashmi
there are 3 types of statements used in jdbc
------
1.createStatement()
2.preparedStatement()
3.callableStatement()
createStatement returns the object of statement.through this we can call methods belongs
to the statement interface.preparedStatement returns the object of preparedstatement.through this we can call methods belongs
to the preparedstatement interface.
The difference b/w statement and preparedstatement is :
if we use statement the sql querry parses by the database server each and every time.when
we send the request. but by using preparedstatement the sql querry parses only once and that
parsed querry is used every time.
for example if there are 100 sql statements by using statement 100 parsings are necessary.
but by using preparedStatement the parsing is happened only once.so we can save the 99 parsings.
The callablestatement is used to call the storedprocedures.
| Is This Answer Correct ? | 15 Yes | 4 No |
What are the new features added to JDBC 4.0?
What is jdbc and jpa?
How a driver can be loaded?
Which of the attributes in the monitoring tab for a jdbc connection pool in the administrative console tell us how many clients are currently waiting for a connection?
How to check null value in JDBC?
How is database middleware used to access legacy databases?
Is the JDBC-ODBC Bridge multi-threaded?
How do I retrieve a whole row of data at once, instead of calling an individual ResultSet.getXXX method for each column?
how can we get the metaData (columnNames) from a table which has no Records..
What is Apache DBCP API?
How to check jdbc driver version in sql server?
Where can I find ojdbc14 jar file?