general database interface and testing stuff