Java Database Connectivity Question and Answers

9. Name the new features added in JDBC 4.0?
  The major features introduced in JDBC 4.0 are
  • Auto loading by JDBC driver class
  • Enhanced Connection management
  • RowId SQL enabled
  • Dataset implemented by SQL by using Annotations
  • Enhancements of SQL exception handling
  • Supporting SQL XML files
 
Your Name Your Email-ID
Your Answer
10. Describe how the JDBC application works?
  A JDBC application may be divided into two layers.
  • Driver layer
  • Application layer
  • The Application layer begins after putting a request to the Driver Manager for the connection.
  • An appropriate driver is chosen and used for establishing the connection.
  • This connection is linked to the application layer.
  • The application needs the connection for creating the Statement kind of objects by which the results are obtained.
 
Your Name Your Email-ID
Your Answer
11. What are the steps involved in establishing a connection?
  This involves two steps:
  • loading the drivers and
  • making the connection
 
Your Name Your Email-ID
Your Answer
12. What is JDBC PreparedStatement?
 
  • JDBC PreparedStatement object represents a precompiled SQL statement.
  • We can use its setter method to set the variables for the query.
  • Since PreparedStatement is precompiled, it can then be used to efficiently execute this statement multiple times.
  • PreparedStatement is better choice that statement because it automatically escapes the special characters and avoid SQL injection attacks.
 
Your Name Your Email-ID
Your Answer
1234 Page 3 of 4