I want to change date format yyyy-mm-dd hh:mm:ss.SSS ( which is stored in database in string format) to mm/dd/yyyy for their comparison
while(rs.next())
You have set myDateFormat1 to "yyyy-mm-dd hh:mm:ss.SSSSSS". I think the first mm should be in uppercase.
"yyyy-mm-dd hh:mm:ss.SSSSSS"
mm
I recommend you check your format strings with the documentation if SimpleDateFormat.