For the add to cart buttons, that is correct, you do not need to have a connection or a data base.
some people prefer to have the order details stored into there own database when a transaction is processed, for this, you would need the connection and database, but it is not necessary.