moved out jdbc functions