Use the Data Accessor pattern when:
-
You want to hide physical data access complexity and platform issues from application logic. Doing so keeps application logic cleaner and more focused on the business objects and processes that it models.
-
You want to manage additional semantics over and above those that the underlying physical database driver provides. Database drivers do not normally handle data distribution or application-level locking mechanisms because the implementation of these features depends heavily on an application's topological and semantic architecture.
-
You want to define multiple data access implementations and choose between them at runtime. Different implementations might accommodate multiple database platforms or even completely new database technology, such as extensible markup language (XML) queries or an object-oriented database.