0% found this document useful (0 votes)
16 views17 pages

Lecture 2.3.2

Uploaded by

Nishant Bhardwaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views17 pages

Lecture 2.3.2

Uploaded by

Nishant Bhardwaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

INSTITUTE : UIE

DEPARTMENT : CSE
Bachelor of Engineering (Computer Science
& Engineering)
PROJECT BASED LEARNING IN JAVA WITH
LAB
(21CSH-319/21ITH-319)
TOPIC OF PRESENTATION:
Configuring various types of drivers for Java Database
Connectivity, MVC Model for project development. (CO 4)

DISCOVER . LEARN .
EMPOWER
University Institute of Engineering (UIE)
Lecture Objectives

In this lecture, we will


discuss:
•Configuring various
types of drivers for Java
Database Connectivity,
MVC Model for project
development.

2
University Institute of Engineering (UIE)
JDBC ARCHITECTURE/JDBC Driver Types
• Type 1
• JDBC-ODBC Bridge
• Type 2
• Native API, partially java driver
• Type 3
• JDBC Network Driver, partially java
• Type 4
• Native-protocol pure Java driver (100% Java )

University Institute of Engineering (UIE)


JDBC ARCHITECTURE/JDBC Driver Types
• Type 1 Driver: JDBC-ODBC Bridge Driver
• Translate JDBC into ODBC and use Windows ODBC built in drivers
• ODBC must be set up on every client
• driver must be physically on each machine for both java applications and applets
• for server side applications, ODBC must be set up on web server
• driver oracle.jdbc.odbc.JdbcOdbc provided by JavaSoft with JDK

Eg: JDBC-ODBC Bridge that


comes with JDK 1.2

University Institute of Engineering (UIE)


JDBC ARCHITECTURE/JDBC Driver Types
• Type 2 Driver: JDBC-Native API
• Native-API partly-Java driver converts JDBC calls into calls on the client
API for Oracle, Sybase, Informix or other DBMS
• like Type 1 drivers; requires installation of binaries on each client & not
suitable for large networks.

Eg: Oracle Call Interface (OCI)


driver.

University Institute of Engineering (UIE)


JDBC ARCHITECTURE/JDBC Driver Types
• Type 3 Driver: JDBC-Net pure Java
• three-tier approach is used to access databases. The JDBC clients use standard network
sockets to communicate with a middleware application server.
• The middleware connects its pure Java clients to many different databases. The type of
protocol in this middleware depends on the vendor.
• Most flexible driver type

University Institute of Engineering (UIE)


JDBC ARCHITECTURE/JDBC Driver Types
• Type 4: 100% Pure Java
• Converts JDBC directly to native API used by the RDBMS
• Requests from client machines are made directly to the DBMS server.
• Compiles into the application, applet & does not require anything to be installed on
client machine, except JVM
• They are also written in 100% Java and are the most efficient among all driver types.

Eg: MySQL's Connector/J driver is a Type 4


driver.

University Institute of Engineering (UIE)


JDBC ARCHITECTURE/JDBC Driver Types
• A Type 4 driver is a pure Java driver, which usually comes as a .jar file and
performs direct calls to the database server. It does not need any configuration
on the client’s machine, other than including the name of the main driver’s
class in your Java code. That’s why it’s also known as the thin driver.
• For example, Java applets can be packaged with this type of driver, which can be
automatically downloaded to the user’s machine along with the applets
themselves.

University Institute of Engineering (UIE)


Which Driver should be Used?

• If you are accessing one type of database, such as Oracle, Sybase, or IBM, the
preferred driver type is 4.

• If your Java application is accessing multiple types of databases at the same time, type
3 is the preferred driver.

• Type 2 drivers are useful in situations, where a type 3 or type 4 driver is not available
yet for your database.

• The type 1 driver is not considered a deployment-level driver, and is typically used for
development and testing purposes only.

University Institute of Engineering (UIE)


MVC Framework
The Model-View-Controller (MVC) is an architectural pattern that separates an
application into three main logical components:
the model,
the view,
and the controller.

Each of these components are built to handle specific development aspects of an


application. MVC is one of the most frequently used industry-standard web
development framework to create scalable and extensible projects.

University Institute of Engineering (UIE)


MVC Components
Following are the components of MVC −
Model
The Model component corresponds to all the data-related logic that the user
works with. This can represent either the data that is being transferred between
the View and Controller components or any other business logic-related data.
For example, a Customer object will retrieve the customer information from the
database, manipulate it and update it data back to the database or use it to
render data.

University Institute of Engineering (UIE)


MVC Components
View
The View component is used for all the UI logic of the application. For example,
the Customer view will include all the UI components such as text boxes,
dropdowns, etc. that the final user interacts with.
Controller
Controllers act as an interface between Model and View components to process
all the business logic and incoming requests, manipulate data using the Model
component and interact with the Views to render the final output. For example,
the Customer controller will handle all the interactions and inputs from the
Customer View and update the database using the Customer Model. The same
controller will be used to view the Customer data.

University Institute of Engineering (UIE)


MVC Flow Diagram

University Institute of Engineering (UIE)


Flow Steps
• Step 1 − The client browser sends request to the MVC Application.
• Step 2 − Global.ascx receives this request and performs routing based on the
URL of the incoming request using the RouteTable, RouteData,
UrlRoutingModule and MvcRouteHandler objects.
• Step 3 − This routing operation calls the appropriate controller and executes it
using the IControllerFactory object and MvcHandler object's Execute method.
• Step 4 − The Controller processes the data using Model and invokes the
appropriate method using ControllerActionInvoker object
• Step 5 − The processed Model is then passed to the View, which in turn renders
the final output.

University Institute of Engineering (UIE)


Summary:

In this session, you were able to :

•Learn about Configuring various types of drivers


for Java Database Connectivity, MVC Model for
project development.

University Institute of Engineering (UIE)


References:
Books:
1. Balaguruswamy, Java.
2. A Primer, E.Balaguruswamy, Programming with Java, Tata McGraw
Hill Companies
3. John P. Flynt Thomson, Java Programming.

Reference Links:
https://www.tutorialspoint.com/mvc_framework/
mvc_framework_architecture.htm
https://www.tutorialspoint.com/mvc_framework/
mvc_framework_models.htm
https://www.guru99.com/mvc-tutorial.html
https://en.wikipedia.org/wiki/Model%E2%80%93view
%E2%80%93controller
https://www.educative.io/blog/mvc-tutorial

University Institute of Engineering (UIE)


THANK YOU

University Institute of Engineering (UIE)

You might also like