open db first