Sunday, 30 June 2019

Common JDBC Component:

  • JDBC have following Component:

JDBC API - (java.sql, javax.sql)
  • Provides access to a relational database (like Oracle, SQL server, MySQL, etc.) from java.
  • Using JDBC API, frontend java application can execute query and fetch data from connected database.

Driver Manager:

  • This class manages a list of database driver.
  • JDBC driver Manager Interface defines 'objects' which are used to connect java application with different JDBC drivers.
  • JDBC Driver manager loads the most appropriate driver among all the drivers for creating a connection.

JDBC test suite:

  • JDBC test Suite is used to check capability of a JDBC driver with J2EE platform.
  • JDBC-ODBC bridge:
  • As the name suggests this enables JDBC access via ODBC drivers.
  • The JDBC Driver contact to the ODBC Driver for connection ti the database.
  • The ODBC driver is already installed or come as deafult driver in windows.

Tuesday, 25 June 2019

JDBC Architecture:





  • The JDBC API supports both two-tier and three tier processing model for database access but in general, JDBC Architecture consist of two layers:
  • 1. JDBC API: This API provides the Application-to-JDBC Manager connection.
  • 2. JDBC Driver API: This supports  the JDBC Manager-to-driver Connection.
  • The JDBC API uses a driver manager and database specific drivers to provide connectivity to database.
  • The JDBC driver manager ensure that the Correct driver is used to access each data Source.
  • The Driver manager is capable of supporting multiple concurrent drivers connected to multiple databases.


Two tier database design:



  • The two-tier is based on Client-Server architecture.
  • The direct Communication takes place between client and server.
  • There is no mediator between client and server.
  • In this type of Database design, User Interface and business Logic is in client side and Database is on server side.
  • The client computer directly access the data without seeing the database. This means that the data on the server is much more secure.

Advantages:
  • It is easy to implement.
  • It is easy to maintain.
  • It performs faster.
  • High portability.

Disadvantages:
  • Performance is reduced when clients increase.
  • More suitable to small scale group and simple for Web-based.

Three tier database design:




  • In this type of Database design, User interface is on client side, Business Logic is on separate application server and database is on Database Server.
  • In three-tier database design, client communicates with database server through application server.
  • Three-tier architecture typically have Presentation tier, Business tier or data access tier,  and data tier.
  • Three layers in the three tier architecture are as follows:

         1. Client layer(Presentation layer)
         2. Business layer(Application layer/Middle layer)
         3. Data layer

Client layer:


  • It is also called as presentation layer which contains UI part of our application.
  • This layer is used for the design purpose where data is presented to the user or input is taken from the user.

Business layer:

  • In this layer all business logic written like validation of data, calculation, data insertion etc.
  • It acts as an interface between client layer and data layer.
  • It is also called the mediator, helps to make communication faster between client and data layer.

Data layer:

  • In this layer actual database is comes in the picture.
  • It contains method to connect with database and to perform insert, update, delete, get data from database based on our input data.
Advantages:
  • Improved security.
  • Performance is higher than 2-tier.
  • Easy to maintain and modification is bit easy.
Disadvantages:
  • Increase Complexity.


Introduction: JDBC


  • JDBC (Java Data Base Connection) is the standard method of accessing database from java Application.
  • JDBC is a Java API  for executing SQL statements. (standard for java Database connectivity.)
  • JDBC is a platform independent interface between relational database and java application.
  • The combination of Java and JDBC  makes it possible for a programmer to "write it once and run it anywhere."
  • JDBC consist of a set of classes and interfaces written in java for connectivity.