your coding is little bit trickywhat will you want to do.just change the codewhile(result.next()){System.out.println(result.getString("name");}remove theresult.previous