1. What is JDBC?
JDBC is an abstraction layer that allows users to choose between different databases. JDBC allows developers to write database applications in Java without needing to be concerned with the specifics of a particular database at the bottom.
2. Explain the role of the drive (Driver) in JDBC.
The JDBC driver provides a specific vendor implementation of the JDBC API interface class, and the driver must provide implementations of these classes under the java.sql package: Connection, Statement, Preparedstatement,callablestatement, ResultSet and driver.
What is the function of the 3.class.forname () method?
Initializes the class specified by the parameter, and returns the class object
What advantages does 4.PreparedStatement have over statement?
Preparedstatements is precompiled, so performance is better. At the same time, different query parameter values, PreparedStatement can be reused.
5. When do I use CallableStatement? What is the method used to prepare the callablestatement?
CallableStatement is used to execute stored procedures. Stored procedures are stored and provided by the database. Stored procedures can accept input parameters, or they can have return results. The use of stored procedures is highly encouraged because it provides security and modularity. The way to prepare a callablestatement is to:
Callablestament.preparecall ();
6. What does the database connection pool mean?
Like open Close database connection this interaction with the database can be time consuming, especially when the number of clients increases, which consumes a lot of resources and costs very high. A number of database connections can be established and maintained in a pool when the application server is started. Connection requests are provided by connections in the pool. After the connection has been used, the connection is returned to the pool for additional requests in the future.
Interview Questions-Database-jdbc