rewired db handle setup and sharing