REGISTER FREE to Receive Instant Job

Tuesday, 9 December 2014

JDBC Interview Questions

What is JDBC?

JDBC is the java API that is used to connect Java Application to the database. This API contains classes and interfaces which are used by Java Programmers to connect Java Applications to the databases.

What is JDBC Driver?

JDBC Driver is a software component that enables java application to interact with the database.There are 4 types of JDBC drivers:

  • Type 1 or JDBC-ODBC Bridge Driver 
  • Type 2 or Native Driver
  • Type 3 or Network Driver
  • Type 4 or Pure Java Native Driver

What is Factory class?

Factory is a creational designed pattern that is used to control the creation of objects. This design pattern is implemented in the form of a factory class.

What are the steps to connect to the database in java?

  • Registering the driver class
  • Creating connection
  • Creating statement
  • Executing queries
  • Closing connection

What are the JDBC API components?

The java.sql package contains interfaces and classes for JDBC API.

Interfaces:


  • Connection:interface provides the abstraction of a database connection and act as a factory of statements. 
  • Statement interface provides the facility of executing sql queries and act as a factory of ResultSet.
  • PreparedStatement interface provides the facility of executing parameterized query.
  • CallableStatement interface provides the facility of invoking stored procedures & functions.
  • ResultSet interface is used to store the result of a SELECT QUERY & act as a factory of Resultset MetaData.
  • ResultsetMetaData interface provides the facility of obtaining information about the result contained in ResultSet.
  • DatabaseMetaData interface is used to obtain information about the database.

Classes:

  • DriverManager:is a utility class that acts as a factory of connections.
  • Blob
  • Clob
  • Types
  • SQLException:is the superclass of all database related exception.

What is the difference between Statement and PreparedStatement interface?

In case of Statement, query is complied each time whereas in case of PreparedStatement, query is complied only once. So performance of PreparedStatement is better than Statement.

2 comments:


  1. The blog or and best that is extremely useful to keep I can share the ideas
    of the future as this is really what I was looking for, I am very comfortable and pleased to come here. Thank you very much.
    tanki online | 2048 game|

    ReplyDelete

Popular Posts

Powered by Blogger.

About Me

My photo

JobsAcid is a 'job search engine' to provide finding a job on the internet easier for the user. It has designed as huge selection of job offerings on the same search engine.