Database access layer.