Return correct database handle