What is DAO
The DAO Design Pattern encapsulates the access required to work with the data source. The data source could be any persistent store like an RDBMS, an external service (B2B exchange), a repository like an LDAP database, etc.
The strength and forces to use DAO design pattern is to completely hide the data source implementation details from its clients. This will allow you to hide the data source connection details from outside client and allows the DAO to adapt to different storage schemes without affecting its clients or business components.
That is mean; the DAO acts as an adapter between the component and the data source.
Create DAO Design Pattern
The following snippet of code illustrates the usage of DAO design pattern, and shows how to utilize JDBC to connect to a data source that refers to Oracle database.
The client interacts with a web service, which in turn, interacts with a Data Access Object that’s encapsulating data source details from outside world.
- From the above figures, we can structure of the application; a client requests a service from a web application.
- The service uses DAO to access the database and get the required info.
- DAO encapsulates the data store connection details.
In the following listing you might find these articles useful
- SQLite Android Example Step by Step
- Image as Button Android Example
- Android RelativeLayout Example
- Run Android Application on Real Devicemple
- Adding onClick Handler Sample - Android Application
- Unknown Run Configuration type in Android Studio