Database class for connection and operations