corrected jdbc query