Answer: Middleware is a program that acts as the middle connection for a client and server .It helps the client and server to connect with each other for sending the request, communication, etc. Middleware is designed in such a way that the functioning does not gets noticed by the client and server.
Example- Two-tier architecture of the client and server for database application can be the train ticket reservation. The reservation made by a people will be according to the time , the person who gets chance to access the reservation first will get the ticket while others wait in queue.
If any query regarding the reservation according to the database occurs then Java Database connectivity (JDBC) will act as the middleware for the Java data collection between the application(client section) and database (server).