0% found this document useful (0 votes)
54 views

Enterprise Application Development Assignment 3 - 102606

JDBC (Java Database Connectivity) is a Java API that allows Java programs to execute SQL statements and retrieve results from a database. It provides a standard interface for connecting to various databases. There are four types of JDBC drivers: Type 1 (JDBC-ODBC bridge), Type 2 (Native API), Type 3 (Network protocol), and Type 4 (Thin pure Java). The JPA (Java Persistence API) is a specification that allows mapping between Java objects and relational databases. It provides APIs for managing relational data in Java applications including APIs for querying, persisting, and retrieving data. The JTA (Java Transaction API) allows applications to perform distributed transactions across multiple networked

Uploaded by

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

Enterprise Application Development Assignment 3 - 102606

JDBC (Java Database Connectivity) is a Java API that allows Java programs to execute SQL statements and retrieve results from a database. It provides a standard interface for connecting to various databases. There are four types of JDBC drivers: Type 1 (JDBC-ODBC bridge), Type 2 (Native API), Type 3 (Network protocol), and Type 4 (Thin pure Java). The JPA (Java Persistence API) is a specification that allows mapping between Java objects and relational databases. It provides APIs for managing relational data in Java applications including APIs for querying, persisting, and retrieving data. The JTA (Java Transaction API) allows applications to perform distributed transactions across multiple networked

Uploaded by

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

Enterprise Application Development Assignment 3

1) What do you mean by Java Database Connectivity (JDBC)?

JDBC or Java Database Connectivity is a Java API to connect and execute the query with the database. It is
a specification from Sun micro systems that provides a standard abstraction (API or Protocol) for java
applications to communicate with various databases like Oracle, MS Access, Mysql, and SQL server database.
It provides the language with java database connectivity standards.

2) Differentiate between JDBC and ODBC.

JDBC (Java Database Connectivity) and ODBC (Open Database Connectivity) are both technologies that
Provide a standardized way for applications to interact with databases. JDBC and ODBC serve the purpose of
connecting applications to databases, they differ in terms of platform support, language specificity, driver

Models, and the ecosystems they are commonly associated with. The choice between them depends on the
specific requirements of the application and the programming languages and platforms being used.

Platform and Language: JDBC is a Java-based API, primarily used for connecting Java applications to
databases. It is platform-independent and specifically designed for Java. ODBC, on the other hand, is a C-based
API that can be used with various programming languages. It is not limited to a single language and can be used
on Windows and some non-Windows platforms.

Driver Model: JDBC drivers are typically written in Java, making them platform-independent. JDBC drivers
can be categorized into four types: Type-1, Type-2, Type-3, and Type-4.ODBC drivers are typically
Written in C and can be platform-specific. ODBC drivers need an ODBC driver manager to work with different
databases.

3) Explain Architecture of Java Database Connectivity with suitable diagram.

Application: It is a java applet or a servlet that communicates with a data source.


The JDBC API: The JDBC API allows Java programs to execute SQL statements and retrieve results. Some
of the important classes and interfaces defined in JDBC API are as follows:
Driver Manager: It plays an important role in the JDBC architecture. It uses some database-specific drivers to
effectively connect enterprise applications to databases.
JDBC drivers: To communicate with a data source through JDBC, you need a JDBC driver that intelligently
communicates with the respective data source.
4) Write in short about the drivers of Java Database Connectivity (JDBC).

JDBC drivers are client-side adapters (installed on the client machine, not on the server) that convert requests
from Java programs to a protocol that the DBMS can understand.
There are 4 types of JDBC drivers:
 Type-1 driver or JDBC-ODBC bridge driver
 Type-2 driver or Native-API driver
 Type-3 driver or Network Protocol driver
 Type-4 driver or Thin driver

 Type 1 driver, a JDBC Bridge is used to access ODBC drivers installed on each client machine. Using
ODBC, requires configuring on your system a Data Source Name (DSN) that represents the target database.
 The JDBC type 2 driver, also known as the Native-API driver, is a database driver implementation that
uses the client-side libraries of the database. The driver converts JDBC method calls into native calls of
the database API. For example: Oracle OCI driver is a type 2 driver.
 The JDBC Type 3 driver is a network-protocol (all-Java driver). This type of driver translates JDBC calls
into the middleware vend or’s protocol, which is then translated to a DBMS protocol by a middleware
server.
 The middleware provides connectivity to many different databases.

 The JDBC type 3 driver, also known as the Pure Java driver for data base middleware, Is a data base driver
implementation which makes use of a middle tier between the call in program and the database.
 The middle-tier (application server) converts JDBC calls directly or indirectly into a vendor-specific
database protocol.
 Type-4 JDBC driver also known as' thin driver' or Direct to Database Pure Java Driver. It is portable, the
fastest among all JDBC drivers and database dependent. The thin driver converts JDBC calls directly in to
the vendor-specific database protocol. It is fully written in Java language.
 The JDBC type 4 driver, also known as the Direct to Database Pure Java Driver, is a database driver
implementation that converts JDBC calls directly into a vendor-specific database protocol. Written
completely in Java, type 4 drivers are thus platform independent.

5) Write Steps To Establish A Connection Using Java Database Connectivity

There are 5 steps to connect any java application with the database using JDBC: These steps are as follows:
1. Register the Driver class

2. Create connection

3. Create statement

4. Execute queries

5. Close connection

6) Describe Java Persistence API in short.

Java Persistence API: is a collection of classes and methods to persistently store the vast amounts of data into
a database which is provided by the Oracle Corporation. To reduce the bur den of writing codes for relational
object management, a programmer follows the ‘JPA Provider’ framework, which allows easy interaction with
database instance. Here the required framework is taken over by JPA.
7) Explain Java Persistence API architecture in short.

The following image shows the class level architecture of JPA. It shows the core classes and interfaces of JPA.

The following table describes each of the units shown in the previous architecture.

Units Description

Entity Manager Factory This is a factory class of Entity Manager. It creates and
manages multiple Entity Manager instances.
Entity Manager It is an Interface, it manages the persistence operations on
objects. It works like factory for Query instance.

Entity Entities are the persistence objects, stores as records in the


database.
Entity Transaction It has one-to-one relationship with Entity Manager. For each
Entity Manager, operations are maintained by Entity
Transaction class.

Persistence This class contain static methods to obtain Entity Manager


Factory instance.
Query This interface is implemented by each JPA vendor to obtain
relational objects that meet the criteria.
8) Briefly explain about Entities, Entity Relationships.

Entities: are nothing but beans or Models. Entities represent persistent data stored in a relational database
automatically using container-managed persistence. They are persistent because their data is stored persistently
in some form of data storage system, such as a database: they do survive a server failure, failover, ora network
failure.

Entity Relationships: Generally the relations are more effective between tables in the database. Here the entity
classes are treated as relational tables (concept of JPA), therefore the relationships between Entity classes are
as follows:
 Many To One Relation

 One To Many Relation

 One To One Relation

 Many To Many Relation

9) Explain Java Transaction API (JTA) in briefe.

The Java Transaction API (JTA) allows applications toper form distributed transactions, that is, transactions
that access and update data on two or more networked computer resources. The JTA specifies standard Java
interfaces between a transaction manager and the parties involved in a distributed transaction system: the
application, the application server, and the resource manager that controls access to the shared resources affected
by the transactions.

10) Différentiâtes between Java Persistence API and Java Transaction API (JTA).

JPA is an object-relational mapping tool that allows mapping between entity objects which are classes
with their corresponding tables and their attributes in the database. Whereas JTA is a tool that allows
you to make multiple transactions in multiple schema.

11) Distingush between Concurrent transactions & Distributed transaction.


Concurrent transactions focus on the ability to execute multiple transactions simultaneously within a single

Database while managing concurrency control. On the other hand, distributed transactions deal with

Transactions that span multiple, geographically distributed databases and require mechanisms for coordinating
and ensuring data consistency across these distributed systems. These are distinct concepts, but in some cases,
distributed transactions can involve concurrent transactions within each of the distributed components.

12) Why there is need of Mobile Databases ?

a) The data in a database can be accessed from anywhere using a mobile database. It provides wireless
database access.

b) The database systems are synchronized using mobile databases and multiple users can access the data
with seamless delivery process.

c) Mobile databases require very little support and maintenance.

d) The mobile database can be synchronized with multiple devices such as mobiles, computer devices,
laptops etc.

13) Explain architecture of Mobile Database in detail ?


The mobile database system provides the database applications environment to prove the
mobile transactions. This advance technology helps the mobile environment to retrieve the
information from the database server and sends it back to the mobile users.

You might also like