A data access layer (DAL) is a specific portion of every computer program which facilitates access between the program and any type of persistent storage. Programs are any applications running on the computer; persistent storage refers to any permanent storage location on the computer, such as the hard drives. While they are running, programs are constantly writing and reading information to and from the hard drive. The data access layer's function is to ensure that any program running on the system is able to get the information it needs as soon as it needs it.
Like a middleman or supplier in a business relationship, the data access layer stands between the program and the storage device. Each program running on the computer which needs to access information on the hard drive has working data access layers. Instead of the main body of the program communicating directly with the persistent storage location, it delegates the responsibility to the data access layer, which then acts on the program's behalf to carry out the task. Its only "job" is to shuffle information back and forth, freeing up the rest of the program to accomplish its other responsibilities.
A typical example of a functioning layer of data access involves a program which requires external information to operate; in other words, information that the program does not intuitively possess. For example, if a program is trying to calculate changes in a company's profit margin over the past 10 years, that information is unlikely to exist within the actual program. It will exist within a company financial records database, however. As the program realizes that it requires "Financial Statement X" or "Earnings Report Y," it tells the data access layer to find that information. The data access layer then siphons the necessary information from the appropriate database or table, returning it to the program so it can continue operating.
Some programs that use a data access layer are database dependent; this means that they are designed to work with one specific database type, limiting their transferability. Others are database independent, providing the ability to function with a wider range of database software. Although it might seem as though dependent data access layer programs are less useful, that is not necessarily the case. As they are programmed to work with one kind of database, they are likely to be optimized more efficiently, providing faster performance while functioning with the intended type of database system.