Interview Questions on Java EE – SQL, JDBC – Part 1

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest

What are the first normal form and the normalization process? What are the normal forms?

The first normal form (1NF) is the basic normal form of the relationship in the relational data model.

The normal form is a property of a relationship in a relational data model, characterizing it in terms of redundancy, potentially leading to logically erroneous sampling or data modification results. The normal form is defined as the totality of requirements that a relation must satisfy. Normal forms: the first normal form, the second normal form, the third normal form, the normal form of Boise – Codd, the fourth normal form, the fifth normal form.

The topic is basic and necessary for detailed study. The size of the answer to this question does not correspond to the format of this article.

What is the meaning of the DBMS index, how are they arranged, how are they stored? How would you implement the same functionality?

Index (English index) is a database object created to improve the performance of data retrieval. Tables in the database can have a large number of rows that are stored in a random order, and their search by a given criterion by sequentially viewing the table row by line can take a long time. The index is formed from the values of one or more columns of the table and pointers to the corresponding rows of the table and, thus, allows you to search for rows that match the search criteria. Acceleration of work using indexes is achieved primarily because the index has a structure optimized for searching – for example, a balanced tree.

The answer to this question also does not fit in one article. Learn by yourself.

What is the JDBC API and when is it used?

JDBC is the standard of application interaction with various DBMSs. JDBC is based on the concept of drivers, which allows you to get a connection to the database using a special URL. The JDBC APIs are in the packages java.sql and javax.sql. Using the JDBC API, you can create database connections, execute SQL queries, store stored procedures, and process results. The JDBC API makes it easy to work with databases from Java programs.

What is a JDBC Driver and what are the different types of JDBC drivers you know?

JDBC is based on the concept of so-called drivers that allow you to connect to a database using a specially described URL. Drivers can be loaded dynamically (while the program is running). Once loaded, the driver registers itself and is called automatically when the program requires a URL containing the protocol for which the driver responds.

There are four types of drivers. Java program works with a DB in two parts. The first part is the JDBC API, and the second is the driver, which does all the work. Each type defines the implementation of the JDBC driver by the increasing degree of platform independence, performance and ease of administration. These four types are:

Type 1: JDBC-ODBC bridge (JDBC-ODBC Bridge plus ODBC Driver) – translates JDBC into ODBC and uses the ODBC driver to interact with the database. Sun included one such driver in the JDK, the JDBC / ODBC bridge. Now there are more successful implementations.

Type 2: Native API / partially Java driver (JAPS) – translates JDBC calls into database-specific calls such as SQL Server, Informix, Oracle or Sybase. The driver of the second type communicates directly with the database server; hence it requires that some binary code is on the client machine side.

Type 3: The network protocol / “pure” Java driver (Pure Java Driver for Database Middleware)- uses a three-tier architecture, where JDBC calls are sent to the intermediate so-called the application server, then this server translates calls (explicitly or indirectly) to calls of the DBMS-specific native interface for further access to the database. If the middle layer server is written in Java, then it can use 1 and 2 type drivers for JDBC broadcasting.

Type 4: The native protocol (“pure” Java driver) – converts JDBC calls to a specific database vendor protocol, so that client applications can directly access the database server. Drivers of the 4th type are fully implemented in Java with the goal of achieving platform independence and eliminating administration and deployment problems.

How does the JDBC API help achieve a weak link between the Java program and the JDBC Drivers API?

The JDBC API uses reflection in java to achieve a weak connection between the Java program and the JDBC drivers. The driver is loaded once using Class.forName (), and then the JDBC API in Java is used. So, we write the code without really thinking about what database we will be working with. If necessary, just specify another driver and do not overwrite a large amount of code.

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on whatsapp
Share on email
Author Bio

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recommended for you
Connect With Us
Stay Connected

Subscribe to our newsletter today to receive updates on latest tech news, tutorials SEO tips many more.

Latest Articles

Global restaurant management software market

Global restaurant management software market was valued US$ 2.43 Bn in 2017 and is expected to reach US$ 7.32 Bn by 2026, at a CAGR of 14.78% during a forecast period.

Free hub for guest blogging nerds and newbie writers

  • Submit Guest Post
  • Share your Knowledge
  • Build your Backlinks
  • Advertise your products
  • Make money by writing
Subscribe to our newsletter today to receive updates on latest tech news, tutorials SEO tips many more.