writing db support. And add some test driver