Vous êtes sur la page 1sur 10

Centralized System Architecture

Companies that needed real computing power turned to the mainframe computer,
which is centralized system architecture. The salient most feature of a centralized system
is that the only movement of marshalling are keystrokes between the client and the host
machine. Marshalling is the process of packing interface elements and sending them
across process boundaries. Thus in a centralized system, keystrokes are marshalling from
the terminal (client) to the host. The centralized system architecture is illustrated in fig.

Application
Data Data

Network Server

Keystrokes

Terminal
Character

Terminal1 Terminal1 Terminal1 Terminal1


Merits of Centralized System Architecture
• Excellent Security
• Centralized administration as both application logic and data reside on the same
machine

De-Merits of Centralized System Architecture


• Mainframe computers are very expensive to buy, lease, maintain and use.
• The limitation is that both the application and the database live within the same
machine process thereby offering no way to truly partition the application logic
beyond the physical limitations of mainframe.
File Server Architecture
The file server system brought a complete change in implementation of the
computer architecture from the mainframe. In this system, the application logic now
executed on the client workstation instead of the server. These servers also provided
access to computing resources like printer and large hard disk. The complete File Server
architecture is illustrated in fig.
The merit of the file server system is the low cost entry point with flexible arrangement.
Computer resources can be added or reduced as and when necessary using this system.
The drawback of the file server architecture is that all application logic is executed on the
client machine. The job of the server is to provide files only to store the data. Though the
application’s file might be located on the server, the application runs in the client
machine’s memory space using the client’s processor. This results in the client machine’s
need memory amount of power to run the application.
Client Server Model
Client server architecture is a process involving a minimum of two independent
entities, one is the client and the other is the server. The client makes a request to the
server and the server services the requests and the resulting data is sent to the client. In
this application, two separate applications operating independently could work together
to complete a task. A well brought out implementation of this concept is the SQL based
Database Management System. The most popular client/server applications revolve
round the use of DBMS such as Oracle and MS SQL server. These applications are
referred to as backend and offer support for storage manipulation and retrieval of
business persistent data. They use structure query language (SQL). As a standard method
for submitting client requests.
Two Tier Client/Server model
In two-tier model, a desktop machine operates as a client and network server function as
a back-end database engine. The logic in two in two-tier model is split between the two
physical location namely the server and client. The client in a two-tier model is
necessarily a 4GL like Visual Basic or Power Builder. The salient point for a two-tier
application is that the business logic must physically reside either on the client or be
implemented on the back-end within the DBMS in the form of triggers and stored
procedures. Both triggers and procedures are stored as precompiled collections of SQL
statements and control-of-flow statements.
In VB, using any of the data controls that provide a graphical link to the back-end data
source create a two tier client/server relationship.

Merits of two-tier
The merits of this two-tier model are – data access is simplified, allowing very
rapid development of applications. The GUI is bound directly to the data source and all
the details of data manipulation are handled automatically. But there is a disadvantage in
this, i.e. though the data access is simplified, it is less flexible due to which the user will
not have complete control of interactions with the data source.

Limitations of Two-Tier model

Not Scalable: Inability of two-tier approach to grow beyond the physical boundaries of a
client and server machine.

Unmanageable: Business rules cannot be encapsulated and deployed centrally because


of which sharing common process and reusing work become difficult.

Poor Performance: The graphical interface binding to the data consumes major
resources on the client machine, which results in poor performance and dissatisfied
clients.

Three-Tier Client/Server Model:


An improved model for client/server development resulted as an outcome of
limited effectiveness of two-tiered client/server solutions. The three-tier client/server
model is based on the ability to build partitioned applications. Partitioning an application
breaks our code into logical components. The Service Model employed to design this
architecture suggests that these components can be logically grouped into three tier. User
services, Business services and Data services. The service and its location are given
below.
Values of three-tier client/server development

Reuse: The time invested in designing and implementing components is not wasted as
they can be shared among applications.

Performance: As components can be placed on machines other than the client


workstation, load processing can be shifted from a client machine that may be
underpowered to a server with extra horsepower. This offers us the best possible methods
for each aspect of our application’s execution, resulting in better performance.
Manageability Encapsulation of applications services into components allows us to
break down large, complex applications into more manageable pieces.
Maintenance: centralizing components for reuse has an added benefit. They become
easier to redeploy on making any amendments to keep pace with business needs.

Data Access Options


Visual Basic provides a variety of options to access remote Client/Server databases. They
are:
Data Access Object (DAO): It communicates with the data source through the JET
database engine.

Data Control: It binds data-aware control to Microsoft Access and other ODBC data
sources.

ODBCDirect: It allows accessing of ODBC data source through the RDO with ADO
objects, bypassing JET database engine.

Remote Data Objects (RDO): It provides a framework for using code to create and
manipulate components of a remote ODBC database system.

Remote Data Control (RDC): It binds the controls to an ODBC remote database.

Open Database Connectivity (ODBC): this is an API call interface to the open
Database Connectivity libraries and drivers to provide data access to Microsoft SQL
server and other database that provide an ODBC driver.

Visual Basic Library for SQL Server (VBSQL): it is an implementation of the DB


library API specifically designed to provide access to SQL Server through a visual basic
application

Active Data Object (ADO): This is a programming model that eliminates the need to
choose from among DAO and RDO and all other data access methods. It is designed to
provide a common bridge between different database, files systems and e-mail servers.
RDO’S

Remote Data Objects (RDO) is specifically designed to access remote ODBC relational
data sources, and makes it easier to use ODBC without complex application code. RDO
is a primary means of accessing SQL Server, Oracle, or any relational database that is
exposed with an ODBC driver.

The general characteristics of RDO are:

• Simplicity (when compared to the ODBC API).


• High performance against remote ODBC data sources.
• Programmatic control of cursors.
• Complex cursors, including batch.
• Ability to return multiple result sets from a single query.
• Synchronous, asynchronous, or event-driven query execution.
• Reusable, property-changeable objects.
• Ability to expose underlying ODBC handles (for those ODBC functions that are
not handled by RDO).
• Excellent error trapping.

There are ten objects in the RDO object model, as described in the following list.

• rdoEngine object The base RDO object. This object is created automatically
when you first access RDO in your application.
• rdoError object Handles all ODBC errors and messages generated by RDO.
This object is created automatically.
• rdoEnvironment object Defines a logical set of connections and transaction
scope for a particular user name. This object contains both open and allocated (but
unopened) connections, provides mechanisms for simultaneous transactions, and
defines a security context for operations on the database. This object is created
automatically.
• rdoConnection object Represents either an open connection to a remote data
source, or an allocated, but as yet unopened, connection.
• rdoQuery object An SQL query statement with zero or more parameters.
• rdoColumn object Represents a column of data, including data type and
common properties.
• rdoParameter object Represents a parameter associated with an rdoQuery
object. Query parameters can be input, output, or both.
• rdoResultset object A set of rows returned from a query.
• rdoTable object Represents the stored database definition of a table or view.
• rdoPreparedStatement object The rdoPreparedStatement object contains a
prepared SQL statement and collection of rdoParameter objects. The
rdoPreparedStatement object is obsolete (although still supported). You should
use the rdoQuery object instead.

An RDO-based application uses the following operations to access a data source.


• Set the environment handle Identifies the memory location for global data and
status information for the defined connections.
• Open the Connection Specifies the connection string with information such as
data source name, user identification, password, default database, network name
of the data source server, and name of the data source driver.
• Open the result set This runs a query and creates a result set.
• Use the result set The result set is now available to your application. Depending
on the cursor type, you can browse and change the item data at either the server or
client side.
• Close the connection Drops the connection to the data source.
• Free the environment handle Drops the global data and frees all associated
memory.

DATA ENVIRONMENT DESIGNER

The Data Environment designer provides an interactive, environment for creating


programmatic data access. At design time, you set property values for Connection and
Command objects, write code to respond to ActiveX® Data Object (ADO) events, execute
commands, and create aggregates and hierarchies. You can also drag Data Environment
objects onto forms or reports to create data-bound controls.

With the Data Environment designer, you can accomplish the following tasks:

• Add a Data Environment designer to a Visual Basic project.

• Create Connection objects.

• Create Command objects based on stored procedures, tables, views, synonyms,


and SQL statements.

• Create hierarchies of commands based on a grouping of Command objects, or by


relating one or more Command objects together.

• Write and run code for Connection and Recordset objects.

• Drag fields within a Command object from the Data Environment designer onto a
Visual Basic form or the Data Report designer.

Before you can access the Data Environment designer, you must reference it in Visual
Basic.

To reference the Data Environment designer

1. On the Project menu, click References.

2. From the References dialog box, select Data Environment 1.0, and then click
OK.

To add a Data Environment designer object to a new Visual Basic project


1. From the New tab of the New Project dialog box, choose Standard EXE project,
and then click Open.

2. From the Project menu, choose Add Data Environment.

The Data Environment designer is added to your Visual Basic project, the Data
Environment designer window appears, and a Connection object is added to your
Data Environment.

To access data using your Data Environment, you must create a Connection object.
Therefore, every Data Environment should include at least one Connection object. A
Connection object represents a connection to a remote database that is used as a data
source.

Upon adding a Data Environment to your Visual Basic project, the Data Environment
designer automatically includes a new connection, called Connection1. At design time,
the Data Environment opens the connection and obtains metadata from the connection,
including database object names, table structures, and procedure parameters.

Creating a Connection Object


The Add Connection function is available at all times and is independent of the
existence of other objects.

To create a database connection

• Click Add Connection on the Data Environment designer toolbar.

-or–

Right-click your Data Environment designer and select Add Connection from the
shortcut menu.

Once you have added a Connection, the Data Environment is updated to show the
new Connection object. The default name for this object is "Connection,"
followed by a number, such as Connection1.

Command Objects
Command objects define specific detailed information about what data is retrieved from a
database connection. Command objects can be based on either a database object (such as
a table, view, stored procedure or synonym) or a Structured Query Language (SQL)
query. You can also create relationships between Command objects to retrieve a set of
related data in the form of a hierarchy

To add a Command object

• Click Add Command in the Data Environment designer toolbar.


-or–

Right-click a Connection object, or your Data Environment designer, and choose


Add Command from the shortcut menu.

Once a Command object is added, the Data Environment's outline view shows the
new Command object. The default name for this object is "Command," followed
by a number, such as Command1.

Data report

A report is an effective way to present data in a printed format. You can display the
information the way you want to see it.

To create a simple hierarchical cursor in the Data Environment designer

1. Create a new Standard EXE project.

2. On the Project menu, click Add Data Environment to add a designer to your
project. If the designer is not listed on the Project menu, click Components.
Click the Designers tab, and click Data Environment to add the designer to the
menu.

Note The first four kinds of ActiveX designers loaded for a project are listed on
the Project menu. If more than four designers are loaded, the later ones will be
available from the More ActiveX Designers submenu on the Project menu.

3. On the Data Link Properties dialog box, click Microsoft Jet 3.51 OLE DB
Provider. This selects the correct OLE DB provider for accessing a Jet database.

4. Click the Next button to get to the Connection tab.

5. Click the ellipsis button (…) next to the first text box.

6. Use the Select Access Database dialog box to navigate to the nwind.mdb file,
which is installed in the Program Files\Microsoft Visual Studio\Vb98 directory.

7. Click OK to close the dialog box.

8. Right-click the Connection1 icon, and click Rename. Change the name of the
icon to Northwind.

9. Right-click the Northwind icon, and then click Add Command to display the
Command1 dialog box. In the dialog box, set the properties as shown below:
Property Setting
Command Name Customers
Connection Northwind
DataBase Object Table
Object Name Customers
10.
11. Click OK to close the dialog box.

12. Right-click the Customers command, and click Add Child Command to display
the Command2 dialog box. In the dialog box, set the properties as shown below:
Property Setting
Command Name Orders
Connection Northwind
DataBase Object Table
Object Name Orders
13.
14. Click the Relation tab. The Relate to a Parent Command Object check box
should be checked. The Parent box should contain Customers; both the Parent
Fields and Child Fields/Parameters boxes should contain CustomerID.
15. Click Add. Click OK to close the dialog box.
16. Set the properties of the project and designer according to the settings below, then
save the project:
Object Property Setting
Project Name prjNwind
DataEnvironment Name deNwind
Form Name frmShowReport
17.

Creating the Data Report


Once the Data Environment designer has been created, you can create a data report.
Because not all of the fields in the data environment will be useful in a report, this series
of topics creates a limited report that displays only a few fields.

To create a new data report

1. On the Project menu, click Add Data Report, and Visual Basic will add it to
your project. If the designer is not on the Project menu, click Components. Click
the Designers tab, and click Data Report to add the designer to the menu.

Note The first four kinds of ActiveX designers loaded for a project are listed on
the Project menu. If more than four designers are loaded, the later ones will be
available from the More ActiveX Designers submenu on the Project menu.

2. Set the properties of the DataReport object according to the table below:
Property Setting
Name rptNwind
Caption Northwind Data Report
3. On the Properties window, click DataSource and then click deNwind. Then
click DataMember and click Customers.
4. Right-click the Data Report designer, and click Retrieve Structure.
5. From the Data Environment designer, drag the CompanyName field (under the
Customers command) onto the Group Header (Customers_Header) section.
6. Delete the Label control (rptLabel) named Label1.
7. From the Data Environment designer, drag the OrderDate field (under the
Orders command) onto the Details (Orders_Detail) section. Delete the Label
control.
8. Resize the Data Report designer's sections to resemble the figure below:

9. Save the project.

Preview the Data Report Using the Show Method


Now that the data environment and the data report objects have been created, you are
almost ready to run the project. One step remains: to write code to show the data report.

To show the data report at run time

1. On the Project Explorer window, double-click the frmShowReport icon to


display the Form designer.

2. On Toolbox, click the General tab.

When you add a Data Report designer to your project, its controls are added to the
tab named DataReport. To use the standard Visual Basic controls, you must
switch to the General tab.
3. Click the CommandButton icon and draw a CommandButton on the form.

4. Set the properties of the Command1 control according to the table below:
Property Setting
Name cmdShow
Caption Show Report
5.
6. In the button's Click event, paste the code below.
7. Private Sub cmdShow_Click()
8. rptNwind.Show
End Sub

9. Save and run the project.

10. Click Show Report to display the report in print preview mode.

Vous aimerez peut-être aussi