You are on page 1of 5

DATTA MEGHE INSTITUTE OF HIGHER EDUCATION AND

RESEARCH
SCHOOL OF ALLIED SCIENCES
FACULTY OF SCIENCE & TECHNOLOGY
MCA SEM II (OL Mode)

Subject: Developing Enterprise Applications


Assignment S/N: 03

Student Name: Atuhaire Dan Beegira


Student Id: SO2022SA00155

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


2. Differentiate between JDBC and ODBC.
3. Explain Architecture of Java Database Connectivity with suitable diagram.
4. Write in short about the drivers of Java Database Connectivity (JDBC).
5. Write Steps to Establish a Connection Using Java Database Connectivity
6. Describe Java Persistence API in short.
7. Explain Java Persistence API architecture in short.
8. Briefly explain about Entities, Entity Relationships.
9. Explain Java Transaction API (JTA) in brief.
10. Differentiate between Java Persistence API and Java Transaction API (JTA).
11. Distinguish between Concurrent transactions & Distributed transaction.
12. Why there is need of Mobile Databases?
13. Explain architecture of Mobile Database in detail?

Page 1 of 21
Table of Contents
1. Java Database Connectivity (JDBC)? ............................................................................................................................. 3
2. JDBC vs. ODBC: .................................................................................................................................................................. 3
3. JDBC Architecture: .............................................................................................................................................................. 3
4. Drivers of JDBC: .................................................................................................................................................................. 3
5. Steps to Establish a Connection Using JDBC:............................................................................................................. 3
6. Java Persistence API (JPA)................................................................................................................................................. 3
7. JPA Architecture:.................................................................................................................................................................. 4
8. Entities and Entity Relationships: ................................................................................................................................... 4
9. Java Transaction API (JTA) ............................................................................................................................................... 4
10. Differences between JPA and JTA: ................................................................................................................................. 4
11. Concurrent Transactions vs. Distributed Transactions:............................................................................................ 4
12. Need for Mobile Databases: ........................................................................................................................................... 4
13. Architecture of Mobile Database: .................................................................................................................................. 4

Page 2 of 21
1. Java Database Connectivity (JDBC)?

Java Database Connectivity (JDBC) is a Java-based API (Application Programming


Interface) that allows Java applications to interact with relational databases. It provides
a set of classes and methods to connect to a database, send SQL queries, retrieve data,
and manage database transactions.

2. JDBC vs. ODBC:


a) JDBC is a Java-based API, while ODBC (Open Database Connectivity) is a C-based
API. JDBC is platform-independent, whereas ODBC is platform-specific.
b) JDBC drivers are written in Java, making them more portable. ODBC drivers are
written in C/C++, which may not be as portable.
c) JDBC uses Java's exception handling for error management, while ODBC uses the
C-style return codes.
d) JDBC can work with any Java-enabled platform, while ODBC is typically used in
Windows environments.

3. JDBC Architecture:
• The JDBC architecture consists of several components: the JDBC API, JDBC
Drivers, Database, and the Java Application. Here's a simplified diagram:

| Java Application | <---> | JDBC API (java.sql) | <---> | Database|

• The Java Application uses the JDBC API to communicate with the database. The
JDBC API connects to the database using an appropriate JDBC driver, which varies
depending on the database vendor.

4. Drivers of JDBC:

JDBC drivers are categorized into four types:

a) Type-1: JDBC-ODBC Bridge Driver


b) Type-2: Native-API Driver
c) Type-3: Network Protocol Driver
d) Type-4: Thin Driver (Direct-to-Database Driver)

5. Steps to Establish a Connection Using JDBC:


1) Load the JDBC driver (typically by calling `Class.forName()`).
2) Establish a database connection using `DriverManager.getConnection()`.
3) Create a `Statement` or `PreparedStatement` to execute SQL queries.
4) Execute SQL queries and retrieve results.
5) Close the database connection and release resources.

6. Java Persistence API (JPA)

JPA is a Java-based specification for object-relational mapping (ORM). It provides a


Page 3 of 21
standard way to map Java objects to relational database tables, making it easier to work
with databases in Java applications.

7. JPA Architecture:

JPA architecture consists of entities (Java classes representing database tables), an entity
manager (responsible for managing entity objects), and a persistence unit (configuration
for database access). It also includes a provider, like Hibernate or EclipseLink, to
implement JPA functionality.

8. Entities and Entity Relationships:


• Entities are Java objects that represent data stored in a relational database. Each entity
corresponds to a table in the database.
• Entity relationships define how entities are related to each other, like one-to-one, one-
to-many, or many-to-many relationships. These relationships are expressed through
annotations in JPA.

9. Java Transaction API (JTA)


JTA is a Java-based API for managing distributed transactions. It provides a standard
way to coordinate transactions across multiple resources (e.g., databases) in a distributed
environment.

10. Differences between JPA and JTA:


• JPA is focused on mapping Java objects to a relational database, while JTA is focused
on managing distributed transactions.
• JPA deals with object-relational mapping and data persistence, while JTA deals with
transaction management in distributed systems.

11. Concurrent Transactions vs. Distributed Transactions:


• Concurrent Transactions: These are transactions that occur simultaneously but do not
necessarily involve distributed systems. They can be executed on a single database or
multiple databases on the same server.
• Distributed Transactions: These transactions involve multiple participants located on
different systems or databases. Coordinating these transactions across distributed
systems can be more complex due to network communication and potential failures.

12. Need for Mobile Databases:

Mobile databases are designed for use in mobile and embedded systems, such as
smartphones, tablets, and IoT devices. They are needed because these devices often have
limited processing power, storage, and intermittent connectivity, making traditional
databases impractical. Mobile databases are optimized for these constraints.

13. Architecture of Mobile Database:


Mobile database architecture typically includes a client-side database that runs on the
mobile device and a synchronization component to exchange data with a central server
Page 4 of 21
or backend database.

The client-side database stores and manages local data, while synchronization ensures
data consistency between the mobile device and the server. Data synchronization can be
triggered manually or automatically based on network availability.

The architecture aims to provide offline access and efficient data transfer in resource-
constrained environments.

Page 5 of 21

You might also like