A DAO (data access object) is a file, in which a user can update the database and perform the interaction with it. In brief, DAO file is an object oriented design pattern, in which the business utility is mixed with the database.
A DAO always work in interaction with the bean objects to save data in form of records in a larger database. A database can be in the form of XML, PDF, txt, CSV or any other form of storage media.
A data access object file is always useful in performing the CRUD tasks -
C - creating the data record
R - read the data record
U - update a record
D - delete a record
To fulfill the purpose of data access object is to interact with given datasource, first of all it is essential for the DAO is to know the details of the datasource. To complete this task, datasource name is passed into string variables and username credentials are also passed to connect the database with the code.
A separate object is implemented into the init () method, which works as a blueprint for the database connections. In the bean utility, there are separate properties used to access the username, data source and password.
Hope you have liked this post ! Thanks for reading it !
reference link -