modify qejdbdatabase to threadsafe; update testcases