In these times where more and more real applications are embracing the middleware as a vehicle for conveying their data, the issue of efficient and effective interoperation between databases with different storage formats and local geographical locations has been becoming extremely important research topic. A large amount of systems have been proposed and developed. However, they mainly suffer from low accuracy and slow query response. The paper presents AgDBMS, a new database middle-ware system specifically designed for effective data management in distributed and heterogeneous environments. Distinguished from previous approaches, our system seamlessly integrates advanced agent technology to facilitate process of data source discovery, result integration, query processing and performance monitoring with a layered structure. In this study, we present the architecture and implementation detail of AgDBMS. The comprehensive experimental result using scientific data and queries demonstrates its advantage in robustness, efficiency and scalability for various distributed queries.