Docsity

ADO.NET and Disconnected Data Access-Implementation and Application in Computer Sciences-Project Report, Study Guides, Projects, Research of Applications of Computer Sciences

Toggle sidebar
bg1
6
1.6 Overview
The remaining section of the document contains the overall description and Requirements
Specifications.
In overall description, general description about the project under discussion,
working, activities involved in the project, constraints, assumptions and dependencies are
discussed.
In requirements specifications functional and non-functional requirements are
described.
2 Overall Description
2.1 ADO.NET and Disconnected Data Access
Majority if applications require data access mechanisms, making it a mandatory
component when working with the web applications. A perfect interaction is made
between data access mechanisms and a database, where all the data is stored. Different
requirements are fulfilled by different applications in order to access the Databases.
ADO.NET can be defined in terms of a database technology that is available within
the .NET framework which is designed to support multi-tiered database applications.
Disconnected architecture is being provided by ADO.NET which is provided over the
internet and based on XML. In disconnected data access based database applications the
importance of disconnected data operations can be felt as when connection establishment
is not an easy task and a connection can be terminated at any time. The advantage of
using disconnected data architecture is that in it database connections are resource-
intensive and it ensures optimum utilization of the system’s resources. Also as the need
of databases is expanding rapidly and more people are served in this manner, a connected
data access model makes us questions about its complexity and productivity. An
application based on connected data access model might support 1 or 2 clients but it
might not do well when 100’s of simultaneous users are connected. So here the difficulty
to have thousands of simultaneous continuous connections is not present [1].
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18

Partial preview of the text

Download ADO.NET and Disconnected Data Access-Implementation and Application in Computer Sciences-Project Report and more Study Guides, Projects, Research Applications of Computer Sciences in PDF only on Docsity!

1.6 Overview

The remaining section of the document contains the overall description and Requirements Specifications.

In overall description, general description about the project under discussion, working, activities involved in the project, constraints, assumptions and dependencies are discussed.

In requirements specifications functional and non-functional requirements are described.

2 Overall Description

2.1 ADO.NET and Disconnected Data Access

Majority if applications require data access mechanisms, making it a mandatory component when working with the web applications. A perfect interaction is made between data access mechanisms and a database, where all the data is stored. Different requirements are fulfilled by different applications in order to access the Databases.

ADO.NET can be defined in terms of a database technology that is available within the .NET framework which is designed to support multi-tiered database applications. Disconnected architecture is being provided by ADO.NET which is provided over the internet and based on XML. In disconnected data access based database applications the importance of disconnected data operations can be felt as when connection establishment is not an easy task and a connection can be terminated at any time. The advantage of using disconnected data architecture is that in it database connections are resource- intensive and it ensures optimum utilization of the system’s resources. Also as the need of databases is expanding rapidly and more people are served in this manner, a connected data access model makes us questions about its complexity and productivity. An application based on connected data access model might support 1 or 2 clients but it might not do well when 100’s of simultaneous users are connected. So here the difficulty to have thousands of simultaneous continuous connections is not present [1].

2.2 ADO.NET Data Architecture

Data access in ADO.NET relies on two components

 Data Provider  DataSet

Figure 1: ADO.NET Architecture

2.2.1 DataSet

The “DataSet” is used to store and retrieve data from the data source. DataSet is also used for the modifications done in disconnected data access architecture instead of direct commands. The DataSet is most fundamental object in ADO.NET hierarchy and it is also fundamental to the disconnected nature of ADO.NET. The DataSet can also be described as a container for data which is held in memory. It permits data to be accessed when a

d) DataRelation

Between multiple tables, relationships are allowed in Relational Databases. These relationships are based on the use of foreign keys and are used to ensure the integrity and consistency of data entered in to the Databases. This ability to define relationship between tables is so useful that it is also included in ADO .NET. A DataRelation object can be used in defining and enforcing the relationship between DataColumns in different DataTable objects. Proper usage of DataRelation concept helps in ensuring referential integrity and the feature of automatic removal of all records from a DataSet can be provided when other related records are deleted [2, 5, 6].

2.2.2 Data Provider

Data Provider is held responsible for maintaining and providing the connection to the Database or it can be said that a DataProvider is the association between the code and the Database. A DataProvider can be viewed as a set of related components that work together to provide data in an efficient, useful, structured and constructive manner. Each DataProvider consists of the following components

a) The connection Object

The Connection object helps in creating the connection to the Database. It is used by the objects to for interaction with the database. The connection object contains all of the information required to open a connection to the database.

b) The command Object

Command objects are used to execute commands to a database and represent queries to the database across a data connection. The command objects may be used to execute SQL commands on the database or retrieval of complete tables directly. Three methods are provided by the command object, which are used to execute commands on the Database.

 ExecuteNonQuery: this executes command that return no values such as Insert, Update or Delete.  ExecuteScalar: this returns a single value on execution of a database query.  ExecuteReader: this returns a result set by means of a DataReader Object.

c) The DataReader Object

The DataReader object provides forward-only and read-only iterations through rows returned from a query. DataReader objects cannot be directly instantiated unlike the other components of the Data Provider. Instead, the Command object's ExecuteReader method returns a result set by means of a DataReader Object. The DataReader can provide rows of data directly to application logic when keeping the data cached in memory is not required. Because only one row is present in memory at a time, the DataReader provides minimum overhead in terms of system optimum performance but requires the efficient use of an open Connection object for the DataReader lifespan.

d) DataAdapter

To obtain the data from the Data Source and cache it locally, ADO.NET object “DataAdapter” as described in following figure [1], will be used. Also to fill the DataSet, a DataAdapter is used. To achieve discussed functionalities, DataAdapter must ensure a valid connection with the Data Source and then it retrieves data using SQL queries using ADO.NET “command Object”. Every DataAdapter can hold four commands which are Select, Insert, Update and Delete. A single DataAdapter object for multiple tasks such as insertion, deletion and updating will be used.

2.3 Updating Disconnected Data

Updating the Data source is more complex operation than reading from it which depends upon the modifying operations which the DataAdapter need to perform.

2.3.1 Controlling Updates

While using the linked tables, standard way of updating the data source can cause some problems, particularly if the records are added, updated and deleted. These problems occur because changes are not committed in the same order they were made. To track this DataSet object would need to store much information which would be a waste of memory on the server. It is required to monitor the cases where update operation is done for a record deleted.

By using the features which are built into the DataSet we can get those rows that need to be added, updated or deleted into separate DataSets and chose an update order or by carefully controlling the insertion, modification and deletion operations that will not place the Database into an inconsistent state at any point. This will certainly add complexity and a considerable amount of extra code. So in those cases disconnected data access will be an extravagant solution to the problem that might get sorted easily [1].

2.3.2 Concurrency Problems

When a number of users try to update or modify the data at same interval, controls need to be defined so that adverse effects of modifications from other users are prevented on one user’s changes or modifications.

ADO.NET keeps information in the DataSet about the current and the original value of every inch of information in the DataSet. When updating a row, ADO.NET searches for a row that matches every “original” field exactly and then updates it with the new values. If another user changes even a single field in that record while the program is working with the disconnected data, an exception is thrown. The update operation is then halted, potentially preventing other valid rows from being updated.

Generally, there are three types of concurrency issues which occur during data manipulation activities:

a) Pessimistic concurrency control

A row is unavailable to users from the time the record is fetched until it is updated in the Database.

b) Optimistic concurrency control

A row is unavailable to other users only while the data is actually being updated. The update examines the row in the Database and determines whether any changes have been made. Attempting to update a record that has already been changed results in a concurrency violation.

c) Last in wins

A row is unavailable to other users only while the data is actually being updated. However, no effort is made to compare updates against the original record; the record is simply written out, potentially overwriting any changes made by other users since one last refreshed the records [7].

The problems caused by the concurrency are

a) The Lost update Problem

We suppose that two persons have a joint account with the balance of 2000 $. First person gets paid and decides to deposit an amount of 200$ to the account using one branch office, afterwards second person decides to withdraw an amount of 100$ from the joint account using another branch office. If these transactions have to be executed serially, one after the other with no other intercorrespondence of operations, the final balance in the joint account will be 2100$. If the transactions were performed concurrently than, they will result in incorrect final balance.

By above mentioned problem, it is concluded that when two transactions are accessing the same database items being operated in an interleaved manner than it makes the database item incorrect.

Figure 3: Client Server Physical model

The necessary requirements are a relational database management system (RDBMS), such as MS-SQL Server, running on Windows Server and a PC running TCP/IP. The applications will be connected to the database server and will requests for the data. The server will than just returns the data which was requested by the client [8].

Request for data

Requesteddata data

data

client

client

client

server

server

Main network

Figure 4: Logical view of Two Tier Architecture

2.4.2 Three Tier Environment

In three tier environments, initially a host of “thin client” applications were developed. The “thin client” applications run the client/server model but from the web server.

The client will only be displaying the user interfaces and data. The client has no role in producing the results. In following figures [8], the physical representation of three tier architecture and logical view of the three tier architecture are given.

Client layer

User interfaces, Data access, Business Rules

Database Layer

Client PC

Physical boundary

Database Server

Figure 6: Logical view of Three Tier Architecture

2.4.3 N-Tier Environment

a) Data Layer

It is the most crucial part and may be quite complex and comprehensive. It relates to DBMS like SQL server, Oracle, MySql, MS Access etc. This layer is specific to retrieval and storage of information. This layer as given in following figure [8] does not deal with the manipulation and delivery of data. It does not relate to implementation part so business logic layer is not required to be placed here. This layer includes store Procedures, query optimization, indexing, binary or text files and .XML files. It is possible to develop a system without the Data layer but it is recommended most of time in most applications.

Client layer

Web Browser Client PC

Web Server

Database Server

Application Layer

User interface, Business Rules, Data Access

Database layer

Physical Boundary

Physical Boundary

Figure 7: N-Tier Architecture logical model b) Business Rule Layer

This is the area where complete knowledge should be dipped; it contains things like the business rules, data manipulation, etc. This layer is implemented in order to encapsulate the business rules. This layer does NOT know anything about HTML, nor does it output it. It does NOT care about ADO or SQL, and it shouldn't have any code to access the Database or the like. We would than be able to concentrate on the performance of the system without the worry of design, workflow, or database access and related concurrency problems. If the business changes, only the business layer is affected, again considerably simplifying future maintenances and enhancements.

In more complicated cases it is entirely possible to have several business layers, each refining the layer beneath it, but that depends on the requirements of the system.

Presentation Layer

Client PC

Physical Boundary

Workflow Layer

Business Rule Layer(s)

Data Layer

Data Layer

(Stored Procedures)

Physical Boundary

Optional physical boundary

Optional physical boundary

Data Store

Database Server

Web Server

2.5 Literature Survey

The literature survey will also be conducted in order to get familiarized with the ADO.NET environment, ADO.NET structure and architecture. The literature survey will than facilitate in the enhancement of functionality and working of the model to be implemented on the basis of the knowledge which will be gathered from the literature survey. In literature survey the prime focus will be on the following components.

a) ASP.NET b) Disconnected Data Access c) ADO.NET Architecture d) Data Access in VS.NET e) ADO.NET Data Adapters and Data Sets f) Distributed applications and Data Integration g) Filtering and Sorting in ADO.NET DataSets h) Relationships in ADO.NET DataSets i) Real-time Data Bases j) XML schemas and Data k) Concurrency issues l) Control Updates

2.6 Experimentation

Simulating a model based on a mechanism for concurrency and control updates will be done to make sure that complete and consistent results are obtained and all the non- functional requirements are satisfied. Experimentation is a very important feature of the Project as it will be done on frequent basis to increase the performance level in adverse circumstances.

The simulation model will be checked against the problems which arise in control update problems stating the ambiguities and conflicts which are generated when

particular order of data manipulation i.e. insertion, deletion and update is followed for the original data source as the changes were made in the ADO.NET object Dataset.

The simulation model for concurrency will be checked for the conflicts and problems which occur when concurrent users try to change the data at the same interval.

Following cases need to be monitored where

 An update is made for a record which has been deleted  Effect of one user’s modification may have adverse effect on other user’s changes or modifications. This will be done making sure that no extra load on server is kept in order to maintain additional information about the DataSet object. Also it is ensured that optimum system resources are utilized.

In Experimentation, Spiral model whose diagram is given in figure 8 [10], will be utilized which states

“The spiral development model is a risk driven process model generator that is used to guide multi-stakeholder concurrent engineering of software intensive systems. It has two main distinguishing features. On is a cyclic approach for incrementally growing a system’s degree of definition and implementation while decreasing its degree of risk. The other is a set of anchor point milestones for ensuring stakeholder commitment to feasible and manually satisfactory system solutions [4].”

Characteristics of Spiral Model

a) High amount of Risk analysis b) Unlike other process models that end when software is delivered, the spiral model can be apply throughout the life of the computer software. c) Spiral model is a realistic approach to the development of large-scale systems and software. Because software evolves as the project process progresses, the developer and customer better understand and react to risks at each evolutionary level. d) It allows reworks of earlier stages as more attractive alternatives are identified.

b) Considerable amount of risks in the form of technical risk, performance risks, support risk and schedule risk stating

c) It is uncertain that the potential design, implementation, verifications and potential problems will be in accordance with the requirements.

d) It is uncertain that the developed mechanism will meet its requirement and be fir for intended use.

e) It is uncertain that the developed mechanism will be easy to adapt and enhance.

f) It is uncertain that the project schedule will be maintained and model will be delivered on time.

g) If one user has inserted a record, tries to update that record as described in following figure 9, now before the record is updated, another user deletes that record. Now in this situation first user can not update that record.

Figure 9: Data Manipulation anomalies (case 1) h) If one user has updated a record, notice the mistake done by him and tries to delete the record as described in following figure 10, now before the record is

insert operation

delete operation

Record

User 1

User 2

update operation

User 1

deleted, another user deletes that record, than the first user will not be able to delete the record.

Figure 10: Data Manipulation anomalies (case 2) i) If one user wants to update a record, now before the record is updated another user deletes that record, than first user will not be able to update the record.

j) In concurrent user environment if three users try to perform modification operation on some record as described in figure 11, than only that user which gets access to that record first will be able to modify that record.

update operation

delete operation Record

User 1

User 2

delete operation

User 1