Which is a better way to connect to a database

The way I see it the database connection is a dependency of the model therefore it should be modeled as such using composition not a trait.