'One database per API or shared database for multiple APIs in Microservice

I started reading microservices architecture and got confused with one below point.

Each service should have a separate database.

Does each service mean a single web(rest) api having its own database?

For example if I take motor insurance claim operation as a business scenario where I modelled business domain services in 3 part Insurance claim services , partner (automobile service providers) services and customer services.

Insurance claim settlement operation in claim api will require other information like incident , survey done by an inspector, policy detail , documents etc. Now I can create 5 web(rest) api in Insurance claim services and will store its data in common db and other services like partner and customer service will have their own web apis and db

What is correct ? All web api (claimAPI, PolicyAPI, IncidentAPI, SurveyAPI and DocumentAPI) in claim insurance services should have their own db or they can keep data in single data base ?

Thanks.



Solution 1:[1]

Here each service means each microservice. For example, If we split a monolith application into 4 different microservices, then each microservice should have a database.

Solution 2:[2]

you can have common database for all microservices, it is one of the microservices patterns:

https://microservices.io/patterns/data/shared-database.html

https://docs.aws.amazon.com/prescriptive-guidance/latest/modernization-data-persistence/shared-database.html

check those links to see advantages and disadvantages of this approach.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Zahid Hassan Alvi
Solution 2 Radek