• +91 9723535972
  • info@interviewmaterial.com

JDBC Interview Questions and Answers

JDBC Interview Questions and Answers

Question - 111 : - What is savepoint and what are the methods we have in JDBC for savepoint?

Answer - 111 : -

Savepoint is used to create checkpoints in a transaction, and it allows us to perform a rollback to the specific savepoint. Once the transaction is committed or rolled backed, the savepoint that has been created for a transaction will be automatically destroyed and becomes invalid.

Methods for Savepoint:

  • setSavepoint() method: It is used to create Savepoint, we can use the rollback() method to undo all the changes till the savepoint.
  • releaseSavepoint() method: It is used to remove the given savepoint.

Question - 112 : - List some exceptions that come under SQLException?

Answer - 112 : -

  • SQLNonTransientException
  • SQLTransientException
  • SQLRecoverableException

Question - 113 : - What is batch processing and how to do it in JDBC?

Answer - 113 : -

Batch processing is the process of executing several SQL statements in one transaction. Doing so will reduce communication time and increase performance. It makes processing a large amount of data much easier.

Advantages of Batch Processing:

Improve performance
Data consistency
How to perform Batch Processing:

We have addBatch() and executeBatch() methods in Java to perform Batch processing. These 2 methods are present in Statement and PreparedStatement classes.

Question - 114 : - What is the stored procedure?

Answer - 114 : - A group of SQL queries that are executed as a single unit to perform a particular task is known as a Stored Procedure. We can pass 3 different types of parameters. Each procedure is represented by its name. So the name of the procedure should be unique.

Question - 115 : - What are the parameter types in Stored Procedures?

Answer - 115 : -

There are three types of parameters available in Stored Procedures. They are:

  • IN: Used to pass the input values to the procedure.
  • OUT: Used to get the value from the procedure.
  • IN/OUT: Used to pass the input values and get the value to/from the procedure.

NCERT Solutions


Share your email for latest updates


Our partners