Database implementation.