Updated database adapter code