Changed the way the database adapter is obtained

Fixed a bug with this.