I'm making a small program in java that is going to run on an embedded device. the purpose of it is to store some values (let's say temperature) in a database located in a cloud.
- Scenario 1: data gets stored every possible cycle (connect-store-store-store... -disconnect)
- Scenario 2: data gets stored every 5 minutes (connect-store-wait-store-wait... -disconnect)
- Scenario 3: data gets stored every hour
Is it better to maintain a constant connection with the database or to connect only when needed? Why?
What would happen if deployed 100 of this devices (one can never have enough temperature data)?