In my own personal discussions with other developers and computer users I’ve seen a fair amount of confusion as to what a database is. Since the purpose of almost all applications is to Create/Read/Update/Delete data, they need to connect to a database, since data persistence storage need to be provided for the application to function as intended. If you want to stick to the simplest definition below, then a file cabinet is technically a database, but now that we’re in the information age we don’t really think of file cabinets as such since we can’t search them very easily without physically looking at every folder or file it contains. Also, the my point in writing this article is to point out what databases are as they relate to software, so I’ll keep things below within the digital sense.
Below I will describe what Databases, Software Database Server and Data Access Layers are. Also, I will define how a Web Service is really both a Data Access Layer or a Database.
What is a Database?
I would refer to the definition that Wikipedia gives as the simplest, most basic definition:
“A database is a collection of data…” from Wikipedia
And, to be a little more specific you can also look at the definition from Wiktionary:
“1. A collection of (usually) organized information in a regular structure, usually but not necessarily in a machine-readable format accessible by a computer.
2.A software program for storing, retrieving and manipulating a database” from Wiktionary
Most Commonly Used Databases
All software databases boil down to file stored on a hard drive or some other persistent storage, but for all practical purposes of developing software there are really 2 basic types of databases:
- "Flat" File
- Software Database Server
"Flat" File Databases
This is the most simplest form of a database used by software, and these are just files stored that contain a “machine-readble” representation of the data stored. Some of the common methods of formating the data within flat files are: XML, JSON, Delimiter-Separated Values (CSV; commonly Tab or Comma separated) or Binary. All of the previously mentioned data formats are “marchine-readable” and “humarn-readable” (meaning that a person could open the file and read it’s contents directly) with the exception of the Binary format. The most common formats used in most applications are probably XML and CSV.
Software Database Servers
Software Databases are applications that provide the service of storing data, allowing you to query the data (usually using the SQL language), and exposing the data to be consumed/modified by another Software Application. At the core of a Software Database Server all data will end up in some kind of File stored within persistent storage (such as a hard drive) and most software database servers will store that data in Binary (“machin-readable” only) format. A couple of the most widely used Software Database Servers are: Microsoft SQL Server and MySQL.
Can an Software Application/Program Be a Database?
Yes! The above difinition of a Software Database Server described a Software Application that is also a Database because it provides the “service” of storing/retrieving data to some other Software Application.
What is a Data Access Layer (DAL)?
When talking about Software and Databases, you can’t leave out Data Access Layers. Below is the definition of Data Access Layer from Wikipedia:
“… a layer of a computer program which provides simplified access to data stored in persistent storage of some kind …”
in the simplest form, a Data Access Layer is just the code or part of a software application that connects directly to a Database. If your application stores data within a Flat File in XML format, then the code that Reads/Updates/Saves the XML file is the Data Access Layer. Also, if your application uses a Software Database Server such as Microsoft SQL Server to store data, then the code that communicates with the MS SQL Server is the Data Access Layer. Simply put, the Data Access Layer is the code that bridges the gap between the Application and the Database.
Is a Web Service a Database or a Data Access Layer?
Well, actually a Web Service is BOTH a Database and a Data Access Layer. To explain why, first we need to define what a Web Service is.
Below is Wikipedias definition of a Web Service:
“Web services are typically application programming (API) or web APIs that can be access over a network, such as the Internet, and executed on a remote system hosting the requested services.”
Basically a Web Service is a Software Application that provides some kind of remotely accessible service that is consumed by another Software Application. If a Web Service provides the service of storing/retrieving data (as most do), then you loop back around to the exact same definition given above of a Software Database Server. Additionally, for a Web Service to be a database it can store/retrieve the data in either “flat” files directly, or use another separate Software Database Server that it accesses to do the storage/retrieval within persistent storage for it.
Additionally, Web Services are most often used as the code or part of a Software Application that connects directly to a Database and provides that data to the Application; bridging the gap between the Application and Database. And, now we have also looped back around to the exact same definition of a Data Access Layer (DAL).
Following the above definition and descriptions of what a Web Service is; it can be concluded that really a Web Service is BOTH a Database and a Data Access Layer.
As you can see, a Web Service can be both a Data Access Layer and a Database. Usually developers only think of a Web Service as a Data Access Layer, but since it provides a collection of data to another application, then it technically is also a Database. Also, the definitions of the terms Data Access Layer and Database as they relate to your Software Application/Program can vary slightly based on your perspective of how they are used. To a Web Developer or Silverlight Developer a Web Service is a Database, but in the perspective of the Software Architect designing the entire solution then the Web Services becomes just a Data Access Layer.
I don’t mean to confuse anyone with this article, nor am I saying that a Data Access Layer and Database are the same thing in all cases. The main point of this article is just to point out that the definition of each term is relative to the way that each piece of the application interacts.
This site is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com. We also participates in affiliate programs with Udemy, and other sites. This site is compensated for referring traffic and business to these companies.