IS444: Modern tools for applications development

Slides:



Advertisements
Similar presentations
ADO vs ADO.NET ADOADO.NET Client/server coupledDisconnected collection of data from data server Uses RECORDSET object (contains one table) Uses DATASET.
Advertisements

Access Lesson 2 Creating a Database
Chapter 10 ADO. What is ADO? ADO is a Microsoft technology ADO stands for ActiveX Data Objects ADO is a programming interface to access data in a database.
1 Chapter 12 Working With Access 2000 on the Internet.
Object-Oriented Application Development Using VB.NET 1 Chapter 13 Introduction to Data Access Classes and Persistence.
ASP.NET Programming with C# and SQL Server First Edition
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Chapter 14: Advanced Topics: DBMS, SQL, and ASP.NET
Chapter 15 - Creating More Complex Database Applications 1 Chapter 15 Creating More Complex Database Applications.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
Programming with Visual Basic.NET An Object-Oriented Approach  Chapter 8 Introduction to Database Processing.
ASP.NET Programming with C# and SQL Server First Edition
Interacting With Data Databases.
Database Programming in Java Corresponds with Chapter 32, 33.
Chapter 15: Using LINQ to Access Data in C# Programs.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 30 – Bookstore Application: Client Tier Examining.
Chapter 14 - Designing Data Access Classes1 Chapter 14 Designing Data Access Classes.
Christopher M. Pascucci.NET Programming: Databases & ADO.NET.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 3 Handling Data in PL/SQL Blocks.
Component 4: Introduction to Information and Computer Science Unit 6a Databases and SQL.
Database Management Supplement 1. 2 I. The Hierarchy of Data Database File (Entity, Table) Record (info for a specific entity, Row) Field (Attribute,
Understanding Databases Lesson 6. Objective Domain Matrix Skills/ConceptsMTA Exam Objectives Understanding Relational Database Concepts Understand relational.
Oracle11g: PL/SQL Programming Chapter 3 Handling Data in PL/SQL Blocks.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Learningcomputer.com SQL Server 2008 –Views, Functions and Stored Procedures.
Object-Oriented Application Development Using VB.NET 1 Chapter 11 Using Multiple Forms with Problem Domain Classes.
1 Working with MS SQL Server Beginning ASP.NET in C# and VB Chapter 12.
Object-Oriented Application Development Using VB.NET 1 Chapter 13 Introduction to Data Access Classes and Persistence.
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
Object-Oriented Application Development Using VB.NET 1 Chapter 15 Assembling a Three-Tier Windows Application.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
SQL IMPLEMENTATION & ADMINISTRATION Indexing & Views.
Understanding Core Database Concepts Lesson 1. Objectives.
SELECT, IMPLEMENT & USE TODAY’S ADVANCED BUSINESS SYSTEMS
Common SQL keywords. Building and using CASE Tools Data Base with Microsoft SQL-Server and C#
Databases and DBMSs Todd S. Bacastow January
CompSci 280 S Introduction to Software Development
ASP.NET Programming with C# and SQL Server First Edition
Microsoft Visual Basic 2010: Reloaded Fourth Edition
Visual Basic 2010 How to Program
VB 2010 Pertemuan 10.
© 2016, Mike Murach & Associates, Inc.
IS444: Modern tools for applications development
Created by Kamila zhakupova
JDBC.
Chapter 4 Relational Databases
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Database System Concepts and Architecture.
Databases and Information Management
VB.NET Using Database.
Chapter 2: Database System Concepts and Architecture
Database Fundamentals
Physical Database Design
CIS16 Application Programming with Visual Basic
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Lecture 1: Multi-tier Architecture Overview
Access Lesson 2 Creating a Database
Databases and Information Management
Chapter 10 ADO.
Database Applications
Creating More Complex Database Applications
Relational Database Design
Chapter 8 Advanced SQL.
Working With Databases
Handling Data in PL/SQL Blocks
DATABASE Purpose of database
Understanding Core Database Concepts
Manipulating Data Lesson 3.
Unit J: Creating a Database
INTRODUCTION A Database system is basically a computer based record keeping system. The collection of data, usually referred to as the database, contains.
Presentation transcript:

IS444: Modern tools for applications development Dr. Azeddine Chikh

Chapter 5: Data Access classes and persistence Part 2. VB.NET reminder Chapter 5: Data Access classes and persistence

Objectives In this lesson, you will: Make objects persistent Design a Data Access class Communicate with a data access class Use a relational database with VB .NET

Making Objects Persistent Object persistence The capacity to store and retrieve information from files Two approaches to achieving persistence Attribute storage Object storage

Making Objects Persistent Attribute storage Involves Retrieving attribute values from the instance Writing attribute values to a file Disadvantage It is necessary to re-create the object

Making Objects Persistent Options for storing and retrieving objects: Attribute storage and retrieval using the StreamWriter and StreamReader Object serialization Attribute storage and retrieval using databases

Making Objects Persistent Object serialization An easy way to store and retrieve objects Serialization process Transforms an object into a stream that can be saved to a sequential file Deserialization Transforms the stream from the file back to the object state before the object was stored Advantage The object can be retrieved intact It is not necessary to re-create the object

Making Objects Persistent Databases One or more files organized to help make queries Can be used to make objects persistent Organize data into tables that can be related to each other Each table column represents an attribute Each row represents a record Structured Query Language (SQL) A standard set of keywords and statements used to access relational databases

Designing a Data Access Class Purpose of a DA class To provide methods that store and retrieve data Make instances of a PD class persistent Reasons for placing data storage and retrieval tasks in a DA class Data input and output code are isolated from other classes Can dramatically reduce maintenance Separate classes for each tier make deployment easier in a client-server environment GUI, PD, and DA functions may reside on multiple machines at various sites

Designing a Data Access Class DA methods can be invoked only by the PD class Services provided by the DA class appear to be provided by the PD class Hides the DA class from all other classes

Data Access Methods A separate DA class is written for each PD class Example: CourseDA Provides data storage and retrieval services for courses Methods can only be invoked by the PD class

Data Access Methods Four basic tasks provided by CourseDA and Course: Retrieve a course Store a course Change a course’s data Remove a course

Data Access Methods CourseDA class Find method AddNew method Functionality implemented: retrieve a course AddNew method Functionality implemented: store a course Update method Functionality implemented: update a course’s data Delete method Functionality implemented: remove a course

Data Access Methods CourseDA class (continued) Additional methods Initialize Terminate GetAll Exception handler classes NotFoundException DuplicateException

Communicating with a Data Access Class Course class Invokes methods in CourseDA  Methods Find AddNew Update Delete Initialize Terminate GetAll

Finding a Course The PD Find method Invokes the DA Find method Public Shared Function Find(ByVal CourseId As String) As Course Return CourseDA.Find(CourseId) End Function

Adding a Course The PD AddNew method Invokes the AddNew method in the DA class to store a new course instance Public Sub AddNew() CourseDA.AddNew(Me) End Sub

Changing a Course The PD Update method Invokes the Update method in the DA class Public Sub Update() CourseDA.Update(Me) End Sub

Deleting a Course The PD Delete method Invokes the Delete method in the DA class Public Sub Delete() CourseDA.Delete(Me) End Sub

Additional Problem Domain Methods Additional PD methods Initialize Public Shared Sub Initialize() CourseDA.Initialize() End Sub Terminate Public Shared Sub Terminate() CourseDA.Terminate()

Additional Problem Domain Methods Additional PD methods (continued) GetAll Public Shared Function GetAll() As ArrayList Return CourseDA.GetAll End Function

Using Relational Databases with VB .NET Referred to as database management systems (DBMSs) Provide tools for organizing data into tables In a DBMS Each column represents a field Each row represents a record Primary key: a field used to uniquely identify a record

Structured Query Language Structured Query Language (SQL) A standardized language used to manage and query relational databases Used by DA methods Find method uses the SQL SELECT statement to Retrieve a specific course’s record from the database AddNew method uses the SQL INSERT INTO statement to Add a new course’s record to the database

Structured Query Language Uses of SQL by DA methods (continued) Update method uses the SQL UPDATE statement to Change the contents of one or more fields in a course’s record Delete method executes the SQL DELETE statement SQL DELETE statement specifies the key value of the course to be deleted

Accessing a DBMS with VB .NET VB .NET options for accessing data ADO (Active-X Data Objects) Maintains a constant connection to the server Data is kept and processed in a recordset ADO .NET Only connects to the server when Data is needed from the data store Updates back to the data store are required Relies on the concept of datasets as the basis for processing data

VB .NET Database Access Classes VB .NET managed providers for accessing data: The OleDb data provider Designed for accessing Microsoft Access databases and other non-SQLServer data sources Namespace: OleDb The SQLServer data provider Designed for accessing Microsoft SQLServer databases Namespace: SQLClient Object database connectivity (ODBC) Can be used to access most other databases

VB .NET Database Access Classes

VB .NET and DBMS Example Example Project involves working with data from a relational database Selecting, adding, updating, and deleting rows from a table The GUI includes A data grid Four buttons Add Record Update Record Delete Record Find

VB .NET and DBMS Example

Implementing Object Persistence with a Database To implement object persistence with a relational database Initialize method establishes a connection to the database Find, AddNew, Update, Delete, and GetAll methods access the database directly Terminate method closes the database connection

Summary Object persistence: storing instance data for future retrieval Persistence can be achieved by storing either attribute values or entire instances A data access (DA) class provides methods that store and retrieve data Methods of a DA class are invoked only by the methods of the corresponding PD class Methods of a DA class: Find, AddNew, Update, Delete, GetAll, Initialize, and Terminate

Summary VB .NET’s stream approach to I/O views data input and output as a flow of bytes Persistence can be achieved using sequential files, object serialization, or relational databases A relational database is used to organize data into tables In a relational database, each column represents a field and each row represents a record SQL is a popular, standard language used to access relational databases