Você está na página 1de 19

why we require database ?

You can query data in a database (ask it questions).


You can look up data from a database relatively rapidly.
You can relate data from two different tables together using JOINs.
You can create meaningful reports from data in a database.
Your data has a built-in structure to it.
Information of a given type is always stored only once.
Databases are fault-tolerant.
Databases can handle very large data sets.
Databases are concurrent; multiple users can use them at the same time
without corrupting the data.
Databases scale well.
what is database ?
A database is simply a collection of organized information, usually as a
set of related lists of similar entries. The data is often organized so that it
is easily accessible.
The following are examples of databases that we use often:
address book
dictionary
telephone book
A computer database is, as the name implies, a collection of data stored
within a computer. It is like an electronic file cabinet full of documents.
What makes computer databases useful is the ease with which the data
can be entered, stored and manipulated.
where we use database ?
Large databases are used all around the world:
Police
criminal records
Department of motor vehicles
driving history
driving records
Banks
all customers and their transactions
Government
statistics
election information
tax records

database
A database consists of a number of interrelated tables.
Each table has a number of records which are used to represent real
world objects.
For example, the police may have a record for each criminal that has
ever been arrested (i.e., the rap-sheet)
Each record has a number of fields which are data items used to specify
a characteristic of the record.(table contains row and column)
Examples of fields are:
name
employee number
address
prior convictions
structure of databaseThe specification of fields of the records in a table is
called the structure of the table.
The structure specifies the type (or kind of data) for each field of each
record.
Different types of fields are treated differently when they are entered,
displayed, or used. Examples of types are:
integer
currency
real number
time
date
Databases Management Systems
A Database Management System, or DBMS, is a computer application
that allows you to work with databases on a computer.
A database management system allows you to easily...
Create/Delete tables
Modify tables: (e.g., adding, deleting, editing and rearranging records,
changing the table structure)
Retrieve data from a table or a number of tables: (e.g., finding and
displaying an individual record, answering queries (i.e., displaying
specified field of records that satisfy a set of specified conditions)
Create reports: (e.g., create formatted output of a list of specified fields
of records that satisfy a set of specified conditions)

database architecture

Objectives of three level architecture are:


1.The DBA can change the structure of database . i.e without changing
the application program e.g external schema.
2.Each user can access the data according to his/her requirements.
3.Users are independent of the storage complexities like indexing
constraints etc of the database.
4.The conceptual structure of the database has no effect due to the
change of the physical storage devices.

The External Level

The external level is one closed to the users. That is the one concerned
with the way in which the data is viewed by individual users. At the
external level the DBMS presents each user with a shared or single view
or schema of the data. there are many views of the data at this level ,
and each view is a representation of part of the complete database. A
view allows a user access to their portion of the database ,and shields
the rest of the database from them. Each external view is defined by
means of an external schema, which consists basically of definitions of
each of the various types of external record found in that external view.
In external level, the different views may have different representations
of the same data. For example one user may view date in the form as
day,month,year while another may view as year ,month ,day.
The Conceptual Level
Conceptual level is the representation of entire contents of database. If
the external level is concerned with individual user views, the conceptual
level may be thought of as defining a community user view. In other
words ,there will be many external views, each consisting of a more or
less abstract representation of some portion of the database and there
will be a single Conceptual view, consisting of a similarly abstract
representation of the database in its entirety.
The conceptual view is defined by the various schema which includes
definition of each of the various types of data or the various types of
conceptual record. The conceptual schema hides the details of physical
structure and concentrates on describing entities, data type ,
relationships, user operations and constraints. The view is normally more
stable than the other two views.
The ultimate objective of the conceptual schema is to describe the
complete enterprise-not just its data but also how that data is used, how
it flows from point to point within the enterprise, what it is used for at
each point, what controls are to be applied at each point and so on.
In most existing system the Conceptual schema is little more than a
simple union of all individual external schemas, with the addition of
certain security and integrity rules.
Hence conceptual level is concerned with the following activities:
1.All entities, there attributes and their relationship.
2.Constraint on the data.
3.Security and integrity rules.
4.Semantic information about the data.
5.Validation checks to retain data consistency and integrity.
The Internal Level
The internal level is the closest to physical storage, that is the one
concerned with the way in which the data is actually stored.
the following aspects are considered at this level:

1.Storage space allocation for data.


2.Record description for storage with stored sizes for data items.
3.Access path e.g. specification of primary and secondary keys, index
and pointers.
4.Data compression and encryption techniques.
5.Optimization of the internal structures.
The internal view is described by means of the internal schema, which
not only defines the various stored record types but also specifies the
indexes are in and so on.
Example

Advantage of three level architecture


1.Each user is able to access the same data but have a different
customized view of the data as per their own needs.
2.A user can change his/her view and this change does not affect other
user views
3.There users interaction with the database is independent of physical
data storage organization.
4.The database administrator (DBA) is able to change the database
storage structure without affecting the users view.
5.The database administrator (DBA) is able to change the conceptual
structure of the database without affecting all users.
6.The database administrator (DBA) can change existing storage devices
with the new storage devices without affecting others users.
Hierarchical database
As its name implies, the Hierarchical Database Model defines
hierarchically-arranged data.
Perhaps the most intuitive way to visualize this type of relationship is by
visualizing an upside down tree of data. In this tree, a single table acts as
the "root" of the database from which other tables "branch" out.
You will be instantly familiar with this relationship because that is how all
windows-based directory management systems (like Windows Explorer)
work these days.
Relationships in such a system are thought of in terms of children and
parents such that a child may only have one parent but a parent can
have multiple children. Parents and children are tied together by links
called "pointers" (perhaps physical addresses inside the file system). A
parent will have a list of pointers to each of their children.

example

Network database
In hierarchical DBMS, we can have only one parent to a child. But in
Network, we can have more than one.
Unlike hierarchical , Network DBMS does not necessarily follow
downward tree structure. In some cases it may follow upward tree
structure.
Please go through the below example to understand better.

ABC College has two Child. i.e. Department A and College library. It
represents one to many relationship. Even though there is no relation
between Department A and College library, a student can be a member
of both Department A and College library. This represents many to one
relationship. So as per the above example, student has two parents
which tell us this is the Network DBMS model. This is the simple and good
example for Network DBMS.
RDBMS

RDBMS stands for Relational Database Management System. RDBMS is


the basis for SQL, and for all modern database systems like MS SQL
Server, IBM DB2, Oracle, MySQL, and Microsoft Access.
A Relational database management system (RDBMS) is a database
management system (DBMS) that is based on the relational model as
introduced by E. F. Codd.

What is table?
The data in RDBMS is stored in database objects called tables. The table
is a collection of related data entries and it consists of columns and rows.
Remember, a table is the most common and simplest form of data
storage in a relational database. Following is the example of a
CUSTOMERS table:

+----+----------+-----+-----------+----------+
| ID | NAME
| AGE | ADDRESS | SALARY |
+----+----------+-----+-----------+----------+
| 1 | Ramesh | 32 | Ahmedabad | 2000.00 |
| 2 | Khilan | 25 | Delhi
| 1500.00 |
| 3 | kaushik | 23 | Kota
| 2000.00 |
| 4 | Chaitali | 25 | Mumbai | 6500.00 |
| 5 | Hardik | 27 | Bhopal | 8500.00 |
| 6 | Komal | 22 | MP
| 4500.00 |
| 7 | Muffy | 24 | Indore | 10000.00 |
+----+----------+-----+-----------+----------+
What is field?
Every table is broken up into smaller entities called fields. The fields in
the CUSTOMERS table consist of ID, NAME, AGE, ADDRESS and SALARY.
A field is a column in a table that is designed to maintain specific
information about every record in the table.
What is record or row?
A record, also called a row of data, is each individual entry that exists in
a table. For example there are 7 records in the above CUSTOMERS table.
Following is a single row of data or record in the CUSTOMERS table:
+----+----------+-----+-----------+----------+
| 1 | Ramesh | 32 | Ahmedabad | 2000.00 |
+----+----------+-----+-----------+----------+

A record is a horizontal entity in a table.


What is column?
A column is a vertical entity in a table that contains all information
associated with a specific field in a table.
For example, a column in the CUSTOMERS table is ADDRESS, which
represents location description and would consist of the following:
+-----------+
| ADDRESS |
+-----------+
| Ahmedabad |
| Delhi
|
| Kota
|
| Mumbai |
| Bhopal |
| MP
|
| Indore |
++------+

Database Languages and Interfaces


Because a database supports a number of user groups, as
mentioned previously, the DBMS must have languages and
interfaces that support each user group.
DBMS Languages
DDL the data definition language, used by the DBA and database
designers to define the conceptual and internal schemas.
The DBMS has a DDL compiler to process DDL statements in order
to identify the schema constructs, and to store the description in
the catalogue.
In databases where there is a separation between the conceptual
and internal schemas, DDL is used to specify the conceptual
schema, and SDL, storage definition language, is used to specify
the internal schema.
For a true three-schema architecture, VDL, view definition language,
is used to specify the user views and their mappings to the

conceptual schema. But in most DBMSs, the DDL is used to specify


both the conceptual schema and the external schemas.
Once the schemas are compiled, and the database is populated
with data, users need to manipulate the database. Manipulations
include retrieval, insertion, deletion and modification.
The DBMS provides operations using the DML, data manipulation
language.
In most DBMSs, the VDL, DML and the DML are not considered
separate languages, but a comprehensive integrated language for
conceptual schema definition, view definition and data
manipulation. Storage definition is kept separate to fine-tune the
performance, usually done by the DBA staff.
An example of a comprehensive language: SQL, which represents a
VDL, DDL, DML as well as statements for constraint specification,
etc.

DDL (commands that create objects) - CREATE TABLE,


CREATE VIEW, CREATE INDEX, CREATE PROCEDURE among
there.
DCL (commands that help in the security of the database)
- GRANT, REVOKE.
DML (commands responsible for altering the data) SELECT,
DELETE,
UPDATE,
INSERT.

Data Manipulation Languages (DMLs)


Two main types:
High-level/Non procedural
Can be used on its own to specify complex database operations.
DMBSs allow DML statements to be entered interactively from a
terminal, or to be embedded in a programming language. If the
commands are embedded in a general purpose programming
language, the statements must be identified so they can be
extracted by a pre-compiler and processed by the DBMS.
Low Level/Procedural
Must be embedded in a general purpose programming language.
Typically retrieves individual records or objects from the database
and processes each separately.
Therefore it needs to use programming language constructs such as
loops.
Low-level DMLs are also called record at a time DMLS because of
this.
High-level DMLs, such as SQL can specify and retrieve many records
in a single DML statement, and are called set at a time or set
oriented DMLs.
High-level languages are often called declarative, because the DML
often specifies what to retrieve, rather than how to retrieve it.
DML Commands
When DML commands are embedded in a general purpose
programming language, the programming language is called the
host language and the DML is called the data sub-language.
High-level languages used in a standalone, interactive manner is
called a query language.

Casual end users use high-level query language to specify requests,


where programmers usually use embedded DML.
Parametric end users usually interact with user-friendly interfaces,
which can also be used by casual users who dont want to learn the
high-level languages.

DBMS Interfaces
Types of interfaces provided by the DBMS include:
Menu-Based Interfaces for Web Clients or Browsing
Present users with list of options (menus)
Lead user through formulation of request
Query is composed of selection options from menu displayed by
system.
Forms-Based Interfaces
Displays a form to each user.
User can fill out form to insert new data or fill out only certain
entries.
Designed and programmed for nave users as interfaces to canned
transactions.
Graphical User Interfaces
Displays a schema to the user in diagram form. The user can
specify a query by manipulating the diagram. GUIs use both forms
and menus.
Interfaces for the DBA
Systems contain privileged commands only for DBA staff.
Include commands for creating accounts, setting parameters,
authorizing accounts, changing the schema, reorganizing the
storage structures etc.
ODBC
Open Database Connectivity (ODBC) is an open standard application
programming interface (API) for accessing a database. By using ODBC
statements in a program, you can access files in a number of different
databases, including Access, dBase, DB2, Excel, and Text. In addition to
the ODBC software, a separate module or driver is needed for each
database to be accessed. The main proponent and supplier of ODBC
programming support is Microsoft.
ODBC is based on and closely aligned with The Open Group standard
Structured Query Language (SQL) Call-Level Interface. It allows programs
to use SQL requests that will access databases without having to know

the proprietary interfaces to the databases. ODBC handles the SQL


request and converts it into a request the individual database system
understands.
ODBC was created by the SQL Access Group and first released in
September, 1992. Although Microsoft Windows was the first to provide an
ODBC product, versions now exist for UNIX, OS/2, and Macintosh
platforms as well.

OLE DB
OLE DB is Microsoft's strategic low-level application program interface
(API) for access to different data sources. OLE DB includes not only the
Structured Query Language (SQL) capabilities of the Microsoft-sponsored
standard data interface Open Database Connectivity (ODBC) but also
includes access to data other than SQL data.
As a design from Microsoft's Component Object Model (COM), OLE DB is a
set of methods (in earlier days, these might have been called routines)
for reading and writing data. The objects in OLE DB consist mainly of a
data source object, a session object, a command object, and a rowset
object. An application using OLE DB would use this request sequence:
1 Initialize OLE.
2 Connect to a data source.
3 Issue a command.
4 Process the results.
5 Release the data source object and uninitialize OLE.
OLE once stood for "Object Link Embedding" and "DB" for database.
However, Microsoft no longer ascribes these meanings to the letters
"OLE" and DB."
ODBC provides access only to relational databases
OLE DB provides the following features
Access to data regardless of its format or location
Full access to ODBC data sources and ODBC drivers
So it would seem that OLE DB interacts with SQL-based datasources
THRU the ODBC driver layer.

Activex data control


ActiveX Data Objects (ADO) is an application program interface from
Microsoft that lets a programmer writing Windows applications get
access to a relational or non-relational database from both Microsoft and
other database providers. For example, if you wanted to write a program
that would provide users of your Web site with data from an IBM DB2
database or an Oracle database, you could include ADO program
statements in an HTML file that you then identified as an Active Server
Page. Then, when a user requested the page from the Web site, the page
sent back would include appropriate data from a database, obtained
using ADO code.
Like Microsoft's other system interfaces, ADO is an object-oriented
programming interface. It is also part of an overall data access strategy
from Microsoft called Universal Data Access. Microsoft says that rather
than trying to build a universal database as IBM and Oracle have
suggested, finding a way to provide universal access to various kinds of
existing and future databases is a more practical solution. In order for
this to work, Microsoft and other database companies provide a "bridge"
program between the database and Microsoft's OLE DB, the low-level
interface to databases.
OLE DB is the underlying system service that a programmer using ADO is
actually using. A feature of ADO, Remote Data Service, supports "dataaware" ActiveX controls in Web pages and efficient client-side caches. As
part of ActiveX, ADO is also part of Microsoft's overall Component Object
Model (COM), its component-oriented framework for putting programs
together.
The JDBC
( Java Database Connectivity) API defines interfaces and classes for
writing database applications in Java by making database connections.
Using JDBC you can send SQL, PL/SQL statements to almost any
relational database. JDBC is a Java API for executing SQL statements and
supports basic SQL functionality. It provides RDBMS access by allowing
you to embed SQL inside Java code. Because Java can run on a thin
client, applets embedded in Web pages can contain downloadable JDBC
code to enable remote database access. You will learn how to create a
table, insert values into it, query the table, retrieve results, and update
the table with the help of a JDBC Program example.
A rough replica of Minimal layout in html5.

Although JDBC was designed specifically to provide a Java interface to


relational databases, you may find that you need to write Java code to
access non-relational databases as well.
JDBC Architecture

Java application calls the JDBC library. JDBC loads a driver which talks to
the database. We can change database engines without changing
database code.
XML
XML stands for eXtensible Markup Language. XML is a meta-markup
language developed by the World Wide Web Consortium(W3C) to deal
with a number of the shortcomings of HTML. As more and more
functionality was added to HTML to account for the diverse needs of
users of the Web, the language began to grow increasingly complex and
unwieldy. The need for a way to create domain-specific markup
languages that did not contain all the cruft of HTML became increasingly
necessary and XML was born.
The main difference between HTML and XML is that whereas in HTML the
semantics and syntax of tags is fixed, in XML the author of the document
is free to create tags whose syntax and semantics are specific to the
target application. Also the semantics of a tag is not tied down but is
instead dependent on the context of the application that processes the
document. The other significant differences between HTML and XML is
that the an XML document must be well-formed.
Although the original purpose of XML was as a way to mark up content, it
became clear that XML also provided a way to describe structured data
thus making it important as a data storage and interchange format. XML
provides many advantages as a data format over others, including:
1 Built in support for internationalization due to the fact that it utilizes
unicode.
2 Platform independence (for instance, no need to worry about
endianess).
3 Human readable format makes it easier for developers to locate
and fix errors than with previous data storage formats.
4 Extensibility in a manner that allows developers to add extra
information to a format without breaking applications that where
based on older versions of the format.
5 Large number of off-the-shelf tools for processing XML documents
already exist.
The world of traditional data storage and XML have never been closer
together. To better understand how data storage and retrievel works in

an XML world, this paper will first discuss the past, present, and future of
structuring XML documents. Then we will delve into the languages that
add the ability to query an XML document similar to a traditional data
store. This will be followed by an exploration of how the most popular
RDBMSs have recognized the importance of this new data storage format
and have integrated XML into their latest releases. Finally the rise of new
data storage and retrieval systems specifically designed for handling XML
will be shown.

SAMLThe Security Assertion Markup Language (SAML) is being developed


by the OASIS XML-Based Security Services Technical Committee (SSTC).
The Security Assertion Markup Language (SAML) is "an XML-based
framework for exchanging security information. This security information
is expressed in the form of assertions about subjects, where a subject is
an entity (either human or computer) that has an identity in some
security domain. A typical example of a subject is a person, identified by
his or her email address in a particular Internet DNS domain. Assertions
can convey information about authentication acts performed by subjects,
attributes of subjects, and authorization decisions about whether
subjects are allowed to access certain resources. Assertions are
represented as XML constructs and have a nested structure, whereby a
single assertion might contain several different internal statements about
authentication, authorization, and attributes. Note that assertions
containing authentication statements merely describe acts of
authentication that happened previously. Assertions are issued by SAML
authorities, namely, authentication authorities, attribute authorities, and
policy decision points. SAML defines a protocol by which clients can
request assertions from SAML authorities and get a response from them.
This protocol, consisting of XML-based request and response message
formats, can be bound to many different underlying communications and
transport protocols; SAML currently defines one binding, to SOAP over
HTTP. SAML authorities can use various sources of information, such as
external policy stores and assertions that were received as input in
requests, in creating their responses. Thus, while clients always consume
assertions, SAML authorities can be both producers and consumers of
assertions."
Why SAML?
Why is SAML required? There are four 'drivers' behind the creation of the
SAML standard:
Limitations of Browser cookies: Most existing Single-Sign On
products use browser cookies to maintain state so that reauthentication is not required. Browser cookies are not transferred
between DNS domains. So, if you obtain a cookie from
www.abc.com, then that cookie will not be sent in any HTTP
messages to www.xyz.com. This could even apply within an

organization that has separate DNS domains. Therefore, to solve


the Cross-Domain SSO (CDSSO) problem requires the application of
different technology. All SSO products solve the CDSSO problem by
different techniques.
SSO Interoperability: How products implement SSO and CDSSO are
completely proprietary. If you are an organization and you want to
perform SSO across different DNS domains within the same
organization or you want to perform CDSSO to trading partners,
then you will have to use the same SSO product in all the domains.
Web Services: Security within Web Services is still being defined.
Most of the focus has been on how to provide confidentiality and
authentication/integrity services on an end-to-end basis. The SAML
standard provides the means by which authentication and
authorization assertions can exchanged between communicating
parties

Você também pode gostar