Access:

» Applications within the Briefcase Model

Related categories: Oracle | Database programming | Delphi

Artur Mościcki, Igor Kruk
Viewed: 5814 | Article date: 2006-05-13 17:17:52

The briefcase model is an application model which lets the user work even without access to the database, e.g. when the user is travelling with a laptop and wants to use the same applications as when he is at a company. The problem is no connection to the database server and thus having no data on the user's laptop. In the article, the authors will create an example application, using the Delphi 7 Enterprise environment and the Oracle 10g DBMS.

The briefcase model is an an application model which lets the user work even without direct access to the database, e.g. when the user is travelling with a laptop and wants to use the same applications as when at the company. The problem is no data on the user's laptop.

About the author

Artur Mościcki and Igor Kruk are fifth-year students of computer science at the Faculty of Exact Sciences of Akademia Podlaska in Siedlce. For quite some time they have been dealing with the cooperation of various environments with databases. They are also the co-authors of the book Oracle 10g i Delphi. Programowanie baz danych (Oracle 10g and Delphi. Programming Databases).You can contact the authors at the following addresses: Artur Mościcki arturmoscicki@op.pl, Igor Kruk igor.siedlce@interia.pl

The briefcase model makes it possible to work even in such circumstances. In the following article we will create an example application, using the Delphi 7 Enterprise environment and the Oracle 10g DBMS.

How does a briefcase model-application work

First, the database tables are written in XML or ADTG format. Next, the files are moved to the user's computer, which contains either a copy of the same application or a slightly modified one. Afterwards the user can be away from the database and continue working with the data; the briefcase-style application reads from the downloaded XML or ADTG files instead of having a direct connection to the database. Should the user make any changes to the record set, instead of having it stored in the database it is written as a xml or adtg file. Upon returning to the company the user can then connect to the database and update the data by copying them from the modified XML or ADTG files to the database. Of course during the user's absence the original database should not be altered or edited, or at least the tables the briefcase application has based its data set on. Therefore, briefcase applications are created for databases or tables usually modified by only one person.

Creating a Table

In order to be able to build the briefcase app an example table must be created first. The example table will be used to store basic information about books. Start iSQL*Plus and use it to run the following script (see Figure 1):

CREATE TABLE Ksiazki

(

ISBN VARCHAR2(50) PRIMARY KEY,

tytul VARCHAR2(100) NOT NULL,

autor VARCHAR2(100) NOT NULL,

opis VARCHAR2(1000)

);

Building the Application

While building the briefcase application we will make use of the ADO (ActiveX Data Objects) technology – a means of accessing databases which emerged from the OLE.DB technology and is now a part of MDAC (Microsoft Data Access Components). More information about MDAC, OLE.DB and ADO can be found on the Microsoft website (http://www.microsoft.com). Delphi 7 Enterprise features a palette of ADO controls – it is components from this palette, as well as ones from palettes: Standard, Data Access and Data Control, that will be used to build the application.

Figure 1. Creating the table Ksiazki with iSQL*Plus

Creating a Connection to the Database

Begin by defining a connection with the Oracle 10g database:

  • open a new Delphi project and place the component ADOConnection1 in the form,

  • define a ConnectionString. This can be done in two different ways: by double-clicking ADOConnection1 or by double-clicking the property ConnectionString of ADOConnection1, in Object Inspector.

Having taken one of these two actions the screen will show a dialogue window (shown in Figure2). As one can see in that figure, the option Use Connection String is checked by default. Another possibility of defining a connection string is to point at a DataLink file (the option Use Data Link File); this will be discussed further on in the article.

  • Click the button Build. A new window shall appear, named Właściwości łącza danych. It contains four tabs: Provider, Connection, Advanced, All. On the Provider tab select the driver Oracle Provider for OLE DB – which is used to establish a connection to an Oracle 10g database. By clicking Next one can move on to the following tab, Connection.

  • On the Connection tab define the data source — SID (the unique identifier of an Oracle database). This was chosen while installing Oracle 10g. If the DBMS has been installed the standard way, it is orcl; the name of the database user; database access password for that user; additionally one can check two options: Empty password (if the user in question has no password defined in the database), Allow storing password must be checked if we don't want to type in the password for every attempt of to connecting to the Oracle 10g database. Therefore, check Allow storing password. Allow storing password must be checked for automatic entry of the password when connecting to the database.

  • An example configuration can be seen in Figure 3. To verify the correctness of configuration, press the button Testuj połączenie. If the database connection attempt has succeeded, the user will receive the message Połączenie testowe powiodło się. Save the connection string by clicking OK in two following windows:

Figure 2. Dialogue window for defining a connection string

A d v e r t i s e m e n t
Linux BSD Unix ranking vote

Page: 1 2 3 4
Buy article Buy subscription
Buy now add to cart
add to cart
Standard price: 2€/$3 Standard price: 25€/$30
Buy article for as little as (2€/$3) each allow access to individual articles. Buy a full access to our Software Developers's Journal archive portal. You will be able to read the articles from all archive issues from year 2005 and 2006. For just 25€/$30 you get unrestricted access to the entire website for the whole year.
SDJhakin9

.SDJ Users:


.:Login
.:Password

[Register]
[Forgotten your password?]

...Shopping Cart

sum: 0 €
Choose currency:

...Topics

...Advertisement

www.acunetix.com www.verifysoft.com

...Conferences




...Print Edition Archive

...Affiliate Program



 

 

Subscribe | Contact Us | Newsletter | Privacy policy | Regulations | See all issues | About SDJ
Copyright C 2006 by Software Developer's Journal. All rights reserved.